[Rt-devel] UserDefined scrip action

Andy Harrison aharrison at gmail.com
Thu Dec 9 11:03:15 EST 2004


On Thu, 9 Dec 2004 16:10:25 +0100 (CET), Jan Okrouhly
<okrouhly at civ.zcu.cz> wrote:
> Hello,
> 
> we use RT 3.2.2 and meet big troubles with custom action scrips - it works
> only sometimes (maybe just only once). This example for is i.e. not
> working well if used in Scrip for specific Queue.
> Is this approach wrong/where is the problem?
> I (customer) doesn't want to use additional files like yours good one
> Action/NotifyGroup.pm, because the LoadedGroup will change depending on
> some ticket info (Customer CustomFields)...
> 
> Prepare part:

You're confusing Scrips with Scripts.  All of that belongs in a perl
script, not in an RT Scrip.

Here's an example of how I add a Cc in a scrip.

Description: AddWatcherCompanyX
Condition: User Defined

Custom condition:
return undef unless ($self->TransactionObj->Type eq "Create");
return undef if ($self->TicketObj->FirstCustomFieldValue('TicketMail')
=~ /Internal/i);
return undef unless ($self->TicketObj->FirstCustomFieldValue('Domain') =~ 
 /CompanyX/i);
return 1;

Action: User Defined
Custom action preparation code:
my ($status, $msg) = $self->TicketObj->AddWatcher(Type => 'Cc', Email
=> "suscom-outage\@gwi.net" );
return 1;

Custom action cleanup code:
return 1;
Stage: TransactionCreate
Template: Global template: Blank


-- 
Andy Harrison


More information about the Rt-devel mailing list