Include body in status change

Hi everyone,

Something very simple but I didn’t find the solution.

I have a custom lifecycle and I want to send a email when the status change to something, so I use a script with user defined condition like

my $type = $txn->Type;
return 0 unless $type eq "Status"
    || ( $type eq 'Set' && $txn->Field eq 'Status');

return 0 unless $txn->NewValue eq "CUSTOM_VALUE";
return 1;

and it’s working, but I would like to add the last answer (from the webui) of the owner so the requestor can know why we denied his request. And seem the


in a template is not what I should put because it’s alway «no content».

To clarify, in the template you’d like to add the content from the last reply?

Yes, the owner (or sometime nobody) go through the webui and make a answer and put the status to «CUSTOM_VALUE». I would like the requestor to get this answer.


In the template when you call $Transaction->Content() that is for the status change transaction I would assume. I believe you could grab the most recent “correspond” transaction from the template though.

Something like this:

    my $txns = $Ticket->Transactions;
    $txns->Limit( FIELD => 'Type', VALUE => 'Correspond' );
    $txns->OrderBy( FIELD => 'Created', ORDER => 'DESC' );

    $OUT = $txns->First->Content();


I didn’t test that syntax but it should give you an idea!

What happens if you change it to a batch scrip?

So it’s working perfectly. Thank you very much

Working too :wink: :wink:

Thanks you very much too.