[rt-users] using custom field that applies to group as custom scrip condition

Kenneth Crocker KFCrocker at lbl.gov
Wed Mar 4 13:39:09 EST 2009


Paul,


	I use the following scrip for the condition and it works for me:

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 => "Review Process");
      return 0 unless $cf->id;
      if  ($trans->Field == $cf->id &&
           $trans->NewValue eq "Review Complete-Approved")
           {
            return 1;
           }
     }

return 0;

	Your scrip seemed to be looking for a "create" transaction. So it will 
only work if the CF value is what your looking for "at the time of 
creation" ONLY. Whereas mine is merely looking for when the CF has been 
altered, WHENEVER. Also, keep in mind is that there is case-sensitivity 
in all comparisons.
	Hope this helps.

Kenn
LBNL


On 3/4/2009 2:46 AM, Paul Vlaar wrote:
> We're trying to base our autoreply on the value of a custom field that
> applies to a group. So I've created a scrip that applies to a queue:
> 
> Condition: User Defined
> Action: Autoreply To Requestors
> Template: Global template: Contract Expiring
> Stage: TransactionCreate
> 
> In the Custom condition this should only trigger when the custom field
> "Contract Status" equals "expiring":
> 
> if ( $self->TransactionObj->Type eq "Create" &&
> $self->TicketObj->GroupObj->FirstCustomFieldValue("Contract Status") eq
> "expiring" )
>   return 1;
> } else {
>   return 0;
> }
> 
> I've also tried:
> 
> $self->GroupObj->FirstCustomFieldValue("Contract Status") eq
> "expiring"
> 
> But this code doesn't trigger the template and I can't seem to find a
> similar example of the use of custom group fields anywhere.
> 
> Thanks,
> 
> 	~paul
> 




More information about the rt-users mailing list