Michael,<br><br>Try this:<br><br>Name: Set Owner on CF<br>Condition: User-Defined<br>Action: User-Defined<br>Template: Blank<br>Stage: TransactionBatch<br><br>Custom Condition:<br>#determine if correct CF & value changed<br>
<br>my $trans = $self->TransactionObj;<br>my $ticket = $self->TicketObj;<br><br>if  ($trans->Type eq 'CustomField')<br>    {my $cf = new RT::CustomField($RT::SystemUser);<br>        $cf->LoadByName(Queue => $ticket->QueueObj->id,<br>
         Name => "Port Completion");<br>     return 0 unless $cf->id;  <br>     if  ($trans->Field == $cf->id &&<br>          $trans->NewValue eq "Ported and Routed")<br>          {<br>
           return 1;<br>          }<br>    }<br><br>return 0;<br><br>Custom Prep Code:<br># set Ticket Owner ID<br><br>
my $ticket = $self->TicketObj;<br>my $ownerid = my id<br><br>$ticket->SetOwner($ownerid);<br>return 1;<br><br>Custom Cleanup Code:<br><br>return 1;<br><br>Hope this helps<br><br>Kenn<br>LBNL<br><br><div class="gmail_quote">
On Tue, Jun 15, 2010 at 12:05 PM, Michael W. Lucas <span dir="ltr"><<a href="mailto:mwlucas@blackhelicopters.org">mwlucas@blackhelicopters.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
I'm trying to write a trigger for a particular custom field, as<br>
described at<br>
<a href="http://wiki.bestpractical.com/view/OnCustomFieldValueChange" target="_blank">http://wiki.bestpractical.com/view/OnCustomFieldValueChange</a>, and<br>
apparently I don't understand something.  I'd appreciate any<br>
enlightenment anyone can offer, pointers to docs I should read, etc.<br>
<br>
I have a CustomField called "Port Completion".  When this CustomField<br>
is set to "Ported and Routed", I want the call assigned to myself.<br>
This CustomField appears to be Field 15, given that the URL ends in<br>
"Modify.html?id=15".<br>
<br>
I've created a scrip for my test queue with the following settings:<br>
<br>
Description: assign owner on port completion<br>
Condition: user defined<br>
Action: user defined<br>
Template: Global template: Transaction<br>
Stage: TransactionCreate<br>
<br>
My custom condition is taken straight from the example.<br>
<br>
unless (<br>
 ( $self->TransactionObj->Type eq "CustomField"<br>
   &&  $self->TransactionObj->Field == 15 )<br>
 ||  $self->TransactionObj->Type eq "Create"<br>
 ) {<br>
   return 0;<br>
}<br>
<br>
return 0 unless $self->TicketObj->FirstCustomFieldValue('Port Completion')<br>
=~ /Ported and Routed/i;<br>
<br>
1;<br>
<br>
The Custom action preparation code is:<br>
<br>
$self->TicketObj->SetOwner('Michael W Lucas');<br>
return 1;<br>
<br>
There is no cleanup code.  This looks like it should be perfectly<br>
straightforward.<br>
<br>
Any suggestions, folks?  Is there any place I can trace what's<br>
happening in the scrip, or what RT is doing when this is run?<br>
<br>
Thanks,<br>
==ml<br>
<font color="#888888"><br>
--<br>
Michael W. Lucas        mwlucas@BlackHelicopters.org<br>
<a href="http://www.MichaelWLucas.com/" target="_blank">http://www.MichaelWLucas.com/</a>, <a href="http://blather.MichaelWLucas.com/" target="_blank">http://blather.MichaelWLucas.com/</a><br>
New book:  Network Flow Analysis<br>
pre-order now!  <a href="http://www.networkflowanalysis.com/" target="_blank">http://www.networkflowanalysis.com/</a><br>
<br>
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.<br>
Buy a copy at <a href="http://rtbook.bestpractical.com" target="_blank">http://rtbook.bestpractical.com</a><br>
</font></blockquote></div><br>