Janet,<br><br>We have something that does exactly that, but with different CF values, of course. We choose to name the CF a name that is different than an RT Ticket field to avoid confusion when referring to fields and simplified the values, but here goes:<br>
<br>Name: WorkFlow for Priority<br>Condition: User-Defined<br>Action: User-Defined<br>Template: Blank<br>Stage: TransactionBatch<br><b><br>Custom Condition:</b><br># Set initial values<br><br>my $trans = $self->TransactionObj;<br>
my $ticket = $self->TicketObj;<br><br># Continue if the CF "Work Ability" has been changed<br><br>if  ($trans->Type eq 'CustomField')<br>    {my $cf = new RT::CustomField($RT::SystemUser);<br>        $cf->LoadByName(Queue => $ticket->QueueObj->id,<br>
         Name => "Work Ability");<br>     return 0 unless $cf->id;<br>    }<br><br>return 1;<br>==================================<br><b>Custom Action Prep:</b><br>
# Set initial values<br>
<br>
my $trans = $self->TransactionObj;<br>
my $ticket = $self->TicketObj;<br>
my $ability = $ticket->FirstCustomFieldValue('Work Ability');<br>my $priority;<br><br>if  ($ability = 'Unable')<br>    {<br>     $priority = 1;<br>    }<br>elsif ($ability = 'impaired')<br>    {<br>

     $priority = 2;<br>
    }<br>
else<br>    {<br>

     $priority = 3;<br>

    }<br><br>$ticket->SetPriority($priority);<br><br>return 1;<br>==================================<br>
<b>Custom Action Cleanup:</b><br>

return 1;<br><br>Basically the same, but I noticed you put a $ in the middle of your Set code ($self->TicketObj-><i><b>$SetInitialPriority</b></i> = $Priority;)<br><br>Hope this helps.<br><br>Kenn<br>LBNL<br><br><div class="gmail_quote">
On Thu, Sep 23, 2010 at 8:15 AM, Bass, Janet E. <span dir="ltr"><<a href="mailto:janet.bass@nist.gov">janet.bass@nist.gov</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;">
I have a custom field called priority<br>
It has 3 possible values<br>
1 Unable to work<br>
2 Work is impaired<br>
3 Info/Low priority<br>
<br>
What I want to do with a scrip is read the value of the custom field<br>
Priority = Unable to work<br>
$Value = Unable to work<br>
Loop through to set the correct value with an if statement<br>
Then assign that numeric value to the system variable priority<br>
<br>
I have tried but nothing set the field I see under The Basic ->priority to<br>
the value I want<br>
$self->TicketObj->$SetPriority = $Priority;<br>
$self->TicketObj->$Priority = $Priority;<br>
$self->TicketObj->$SetInitialPriority = $Priority;<br>
<br>
<br>
Scrip code (under Custom action cleanup code) I have return 1; under Custom<br>
action preparation code<br>
<br>
my $CFName = 'Priority';<br>
my $Value = $self->TicketObj->FirstCustomFieldValue( $CFName );<br>
my $Priority = 3;<br>
if ($Value =~ /Unable/i)<br>
{<br>
$Priority = 1;<br>
}<br>
elsif ($Value =~ /impaired/i)<br>
{<br>
$Priority = 2;<br>
}<br>
else<br>
{<br>
$Priority = 3;<br>
}<br>
<br>
$self->TicketObj->$SetPriority = $Priority;<br>
<br>
return 1<br>
<br>
Thanks for any help<br>
Janet Bass<br>
<br>
<br>
RT Training in Washington DC, USA on Oct 25 & 26 2010<br>
Last one this year -- Learn how to get the most out of RT!<br>
</blockquote></div><br>