Send message to requestor OnComment

Hi Community,

I’m trying to fire a scrip, which sends a message of last comment (OnComment) but
ONLY if a CustumField’s value == “ABORTED”.

Condition: On Comment
Action: Notify Requestor

Custom action preparation code:

return 1 if ( $self->TicketObj->FirstCustomFieldValue('Status') eq 'ABORTED' );
return undef;

What I’m doing wrong, because RT sends always messages?..

Thanks

Your code won’t be read as you don’t have the “user defined” action selected, you have “Notify Requestor”.

I’d suggest making the condition “User Defined” and leave the action as is, you can use your existing check and will also want to check that the transaction is a comment:

return unless $self->TicketObj->FirstCustomFieldValue('Status') eq 'ABORTED';
return unless $self->TransactionObj->Type eq 'Comment';
return 1;

Thanks, it works in case,when I make a comment and a custom field modification manually.
Will it work with REST2 request?