[rt-users] problem with trigger

Michael W. Lucas mwlucas at blackhelicopters.org
Tue Jun 15 15:05:56 EDT 2010


Hi,

I'm trying to write a trigger for a particular custom field, as
described at
http://wiki.bestpractical.com/view/OnCustomFieldValueChange, and
apparently I don't understand something.  I'd appreciate any
enlightenment anyone can offer, pointers to docs I should read, etc.

I have a CustomField called "Port Completion".  When this CustomField
is set to "Ported and Routed", I want the call assigned to myself.
This CustomField appears to be Field 15, given that the URL ends in
"Modify.html?id=15".

I've created a scrip for my test queue with the following settings:

Description: assign owner on port completion
Condition: user defined
Action: user defined
Template: Global template: Transaction
Stage: TransactionCreate

My custom condition is taken straight from the example.

unless (
 ( $self->TransactionObj->Type eq "CustomField"
   &&  $self->TransactionObj->Field == 15 )
 ||  $self->TransactionObj->Type eq "Create"
 ) {
   return 0;
}

return 0 unless $self->TicketObj->FirstCustomFieldValue('Port Completion') 
=~ /Ported and Routed/i;

1;

The Custom action preparation code is:

$self->TicketObj->SetOwner('Michael W Lucas');
return 1; 

There is no cleanup code.  This looks like it should be perfectly
straightforward.

Any suggestions, folks?  Is there any place I can trace what's
happening in the scrip, or what RT is doing when this is run?

Thanks,
==ml

-- 
Michael W. Lucas 	mwlucas at BlackHelicopters.org
http://www.MichaelWLucas.com/, http://blather.MichaelWLucas.com/
New book:  Network Flow Analysis
pre-order now!  http://www.networkflowanalysis.com/



More information about the rt-users mailing list