[rt-users] Changing Scrip Order Precedence?

Mike Patterson mikep at uclink.berkeley.edu
Fri Jan 13 13:48:39 EST 2006


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 
dog at mydomain.com)
#and other people are not already Requestors,Cc,AdminCc (cat at mydomain.com)
#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 cat at mydomain.com as an AdminCc if prep code above returns true
my $admincclist = $self->TicketObj->AdminCc;

my $user = RT::User->new($RT::SystemUser);
$user->LoadByEmail('cat at mydomain.com');

$admincclist->AddMember($user->Id);
return 1;
---------------------------------------------
BTW I'm leaning on examples from here:
http://wiki.bestpractical.com/index.cgi?AddAdminCc

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




More information about the rt-users mailing list