[rt-users] scrip change customfieldvalue on certain value

Kenneth Crocker KFCrocker at lbl.gov
Fri Oct 17 14:20:02 EDT 2008


Violetta,


	Try something like this:

# condition execution on value of CF "CFA"

my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;

if  ($trans->Type eq 'CustomField')
     {my $cf = new RT::CustomField($RT::SystemUser);
         $cf->LoadByName(Queue => $ticket->QueueObj->id,
          Name => "CFA");
      return 0 unless $cf->id;
      if  ($trans->Field == $cf->id &&
           $trans->NewValue eq "Value1")
           {
            my $current_Value = "Value1";
            return 1;
           }
      else
           {
            my $current_Value = $trans->NewValue;
           }
     }

return 0;


	Something along those lines should work. I didn't know if you wanted to 
save the new value or do something, etc. Hope this helps.

Kenn
LBNL

On 10/17/2008 7:16 AM, Violetta Wawryk wrote:
> Hi,
> 
> has anyone a scrip or an idea how my condition for the following 
> situation has to be written?
> 
> My customfield called "CFA" has for example the value "value1" and 
> "value2". The value is currently set to "value1". I now want my scrip to 
> check wheather the value has changed and to which value it has changed. 
> And that is exactly my problem. How do I check what the new value is?
> 
> The first part would be:
> 
> if ($self->TransactionObj->Type eq "CustomField" &&
> 
> and what comes after &&  ??
> 
> Thanks a lot for your help!
> 
> Violetta
> 




More information about the rt-users mailing list