Changing Scrip Order Precedence?

RT folks,

Is there any way I can change the order in which scrips are evaluated?

In my case I’m working on a scrip that adds a manager as an AdminCc if
an annoying person is submitting a ticket (or is Cc’d on one).
It works fine but, the only problem is that the other “On Create” scrips
seem to send out their emails before the person gets added as a
AdminCc. So that AdminCc that I just added misses that message, but
they get other future correspondence on that ticket.

Any insights into on how this works or how to fix it are appreciated.

My Scrip:
Description: Add AdminCc if lunkhead
Condition: OnCreate
Action: User Defined
Template: Global template: Blank
Stage: TransactionCreate
Custom condition:
Custom action preparation code:

#goal of prepcode: if certain folks are Requestors,Cc,AdminCc (e.g
#and other people are not already Requestors,Cc,AdminCc (
#then go to action cleanup code section below, else exit (e.g. return 0)

my $people = $self->TicketObj->RequestorAddresses;
$people .= $self->TicketObj->AdminCcAddresses;
$people .= $self->TicketObj->CcAddresses;

if (($people =~ /dog@/i) && ($people !~ /cat@/i)) {
return 1;
return 0;

Custom action cleanup code:
#add as an AdminCc if prep code above returns true
my $admincclist = $self->TicketObj->AdminCc;

my $user = RT::User->new($RT::SystemUser);

return 1;
BTW I’m leaning on examples from here:

My RT test box:
RT 3.4.4, FedoraCore4, Perl 5.8.6, HTML Mason 1.3101, mod_perl2, Apache2

Mike Patterson
Systems Manager
UC Berkeley Extension

Not by default.

You can activate and use the Batch stage but that has limited usefulness.

You can extend RT to order scrips for you though.

In our we have the following method:

sub FindScrips {
my $self = shift;
my %args = (
Stage => undef,
Type => undef,

$self->LimitToQueue( $self->{'TicketObj'}->QueueObj->Id )
  ;    #Limit it to  $Ticket->QueueObj->Id
  # or to "global"

$self->Limit( FIELD => "Stage", VALUE => $args{'Stage'} );

my $ConditionsAlias = $self->NewAlias('ScripConditions');

    ALIAS1 => 'main',
    FIELD1 => 'ScripCondition',
    ALIAS2 => $ConditionsAlias,
    FIELD2 => 'id'
#We only want things where the scrip applies to this sort of transaction
# TransactionBatch stage can define list of transaction
foreach( split /\s*,\s*/, ($args{'Type'} || '') ) {
        ALIAS           => $ConditionsAlias,
        FIELD           => 'ApplicableTransTypes',
        OPERATOR        => 'LIKE',
        VALUE           => $_,

# Or where the scrip applies to any transaction
    ALIAS           => $ConditionsAlias,
    FIELD           => 'ApplicableTransTypes',
    OPERATOR        => 'LIKE',
    VALUE           => "Any",

$self->OrderBy( FIELD => 'description');

$RT::Logger->debug("Found ".$self->Count. " scrips");


The only thing that we changed was is the “$self->OrderBy( FIELD =>
‘description’);” line near the end of the method. This sorts scrips by
the description of the scrip. Thus a scrips description just needs to
start with a prefix to determine ordering (we use a three diget number
– so we won’t ever have to reorder).

Joby Walker
ITI SSG, C&C, University of Washington

Mike Patterson wrote: