Skrip: Subject Change Gets Not Commited

Good Nighttime,
i’ve created a skrip that changes the subject of an ingoing mail. It’s the first skrip in the list and its description starts with 0001.

It skrip should change the subject of the ingoing email by $self->TicketObj->SetSubject and is executed properly. However, the NotifyAdminCC Skrip takes the hold subject even if the history of a ticket is the follwoing

  1. recorded ingoing mail
  2. change of subject
  3. send out notification

The change of the subject is also represented in the subject of the ticket itself, but not in the mail.

How can i commit this change so that is also in outgoing mails?

Thank you in advance

This is working as expected IMHO.

As I understand it, RT first checks all scrip conditions, then processes them.
Once all the applicable ‘conditions’ have been processed, it then processes the ‘action commit code’. The exception to this behaviour is when a scrip is configured to be a ‘batch’. Batch scrips are executed after normal scrips have been completely executed.

If your ‘NotifyAdminCC Scrip’ is the default one, you’ll need to disable it and make one dedicated for the queue (and make a default one for any other queues). When you create the ‘NotifyAdminCC Scrip’ for your queue that is renaming the subject, make that a batch scrip.

While this is a very simplified solution, hopefully it should work.

The proper solution would be to have multiple Notify scrips with Custom Condition code; ones that are actioned on normal communications when the subject has not changed, and ones that are actioned when the subject has changed. I’ve done similar before, however it gets complicated - too complicated to explain here.

1 Like

Yes, that should be the point. More info at https://rt-wiki.bestpractical.com/wiki/ScripExecOrder and https://rt-wiki.bestpractical.com/wiki/TransactionBatchStage.

1 Like

Thanks for you reply. I’ve tried to make a batch NotifyAdminCC Scrip that only applies to the said queue, but it does not send out the mail with the changed subject.

UPDATE

Adding Subject: {$Ticket->Subject} to the Perl Template of the Queue did the trick.

Solution:

  1. moving script to notify in batch stage
  2. ensuring that the subject will be set in the template
1 Like