This part works properly i.e. the script is triggered.
What I would like now is to have a custom action that would automatically add a correspondence to this ticket that would contain some additional message like:
Please note that Start or Due date has been changed
Your current Start date: 2025-09-04 14:00
Your current Due date: 2025-09-10 18:00
I can’t figure out how to add new correspondence from such script. Any help apprieciated
Does adding such correspondance in a script triggers in parallel automatically “On Correspond” script or this acction is just executed and visible i ticket history (that’s what I’d like to achieve) ?
If you create a new transaction (such as correspondence or comment), then you should cause a new cascade of scrips to be processed for that. So in your case, the new correspondence will trigger any “OnCorrespond” at least (and maybe others if you have custom conditions that also match).
Thank you for suggestion. For the simplicity of debugging I put the following into “Custom Action Commit Code”:
my $ticket = $self->TicketObj;
my $comment = "Please note that Start or Due date has been changed";
($transaction, $msg) = $ticket->Correspond(Content => $comment);
unless ($transaction) {
RT::Logger->error("Any error-message: " . $msg);
}
Then, when I change the Start date the script is triggered properly (I got mail from template). However the History page in RT ticket Gui doesn’t show any additional transaction/correspondance containing the above comment just Set action and info that email was sent:
The transaction is a usual transaction an should appear.
I think you need to return 1;, anyway. Maybe that’s the point.
After this there are many things tha can trigger
Is the user allowed to see comments?
Use history instead of display and look there.
Is there anything in rt.log?
If “SeeOutgoingMail” is enabled, do you see the mail?
I added to “Custom action commit code:” the following:
my $ticket = $self->TicketObj;
my $comment = "Please note that Start or Due date has been changed";
($transaction, $msg) = $ticket->Correspond(Content => $comment);
unless ($transaction) {
RT::Logger->error("Any error-message: " . $msg);
}
return 1;
In the RT web interface under ticket’s History I can’t see any transaction - just info about changing fields values and email sent:
The content of the email sent by a template used by this script is using the following logic to display transactions:
{$Transaction->Content() . "\n";}
but it prints “This transaction appears to have no content” in the email sent
Yes, user is allowed to see comments
I’m looking at history
Yes, email is triggered but also doesn’t contain the transaction content
Nothing special in the log