Refresh ticket after trigger

lock
push_pin
done
Besvart
5

(New Service)
Is it possible to refresh a ticket after specific triggers has run for the ticket? 

I need to remove the email headers from a new message before it displays and prevent the sendout of the message, so this is what i have come up with.




In the trigger "Outbound email or SMS created"
Copies the new message without the emailheaders and deletes it so I have an new message without the emailheaders.
Prevents the sendout of the now deleted message. 

I tried to do the copy message function in the "New External message on request" trigger, but that didn´t work cause when i tried to run the NSTicketAgent.

DeleteTicketMessageEntity function does an "object not set to an instance of an object" error pop up and the ticket is undefined.



The problem with trigger "Outbound email or SMS created"
After the save does the messagelist contain both the new copied message and the old one.

However when i do a refresh does the old message disappear. 

So is there any way to refresh the ticket so that the old message gets removed properly?




9. jan. 2025 | 01:26 p.m.

Alle Svar (5)

Hi Fredrik,

Should be possible to force a refresh in your trigger with : ed.setNavigateTo("soprotocol:ticket.main[refresh=true]");

10. jan. 2025 | 07:04 a.m.
Hi Michel,
I tried to do that in the trigger, but nothing happend, so i´m not 100% sure if the ticket triggers work with the "setNavigateTo" function.
I believe the "setNavigateTo" works in task menu scripts that are running from the new service, but in this case do I need to run the script when the user creates a new message so the task menu script is not an option.
10. jan. 2025 | 08:25 a.m.

Hi Fredrik,

Yes you are correct, trigger you have connected to happens in background so then there is really no way to hook it up to UI unfortunately. 

If you review this tutorial you will see the available options. If you can live with the headers being present it is pretty easy to just block sending. 

10. jan. 2025 | 08:55 a.m.
Unfortunately do I need to remove the headers since the e-mail won´t be sent out in this flow, there are other flows based on categories where the message actually gets sent out to the customer, so it needs to be removed in order to not cause confusion for the user.
Is scheduled task the only option in this case where we can remove it or is there any other solution?
10. jan. 2025 | 09:02 a.m.

Looks like there is not really any other solutions I can come up with unfortunately. Sequence of events makes it difficult.

10. jan. 2025 | 09:26 a.m.

Legg til svar