AddWatcherPerTicket
Comments0this wiki
You can use this Scrip to add a Watcher to a particular ticket. One possible use would be to have tickets of a particular urgency (as in the custom condition below) forwarded to an 'emergency' email address, or to someone's phone via an email-SMS gateway.
Note that you need to set up two scrips for this: the first to add the extra Watcher, and the second to send the email. This is because of the order in which RT runs through its automatic & user-defined actions.
First scrip
Condition: User Defined
Custom Condition:
return undef unless ( ($self->TransactionObj->Type eq "Create") ||
( $self->TicketObj->FirstCustomFieldValue('Urgency') eq "High"));
return 1;
Action: User Defined
Custom action preparation code:
$self->TicketObj->AddWatcher( Type => "Cc",
Email =>"address\@email.com");
push( @{$self->{'To'}},
$self->TicketObj->Requestors->MemberEmailAddresses,
$self->TicketObj->QueueObj->Cc->MemberEmailAddresses );
return 1;
Custom action cleanup code:
1;
Template: Global Template: Transaction
Second scrip
Condition: On Create
Action: Notify Ccs
Template: Global Template: Transaction
- I had problems with scrip order to get this to work. The Notify scrip has to be executed after the Add CC scrip. See ScripExecOrder
See also: ManualScrips, WriteCustomAction, WriteCustomCondition