OnCreationOfApprovalTicket

From Request Tracker Wiki
Jump to navigation Jump to search

Condition : On Creation of new approval ticket

By default in RT 3.6.6 the Approvals queues has a scrip called...

"When an approval ticket is created, notify the Owner and AdminCc of the item awaiting their approval"

This scrip contains the User defined condtion as:

$self->!TicketObj->Type eq 'approval'	      and
$self->!TransactionObj->Field eq 'Status'	and
$self->!TransactionObj->!NewValue eq 'open'  and
eval { $T::Approving = ($self->!TicketObj->!AllDependedOnBy( Type => 'ticket' ))[0] }

I have been unable to make this condition trigger in an of my 3.6.6 installs.


So I wrote my own that seems to work fine. Please feel free to update / enhance.

It is as follows:

my $result = 0;
if ($self->TicketObj->Type eq "approval") {
  if($self->TransactionObj->Type eq "Create") {
    $RT::Logger->debug("Approval ticket created: Notify Owner");
    $result = 1;
  }
}
return($result);