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

Paul Vlaar paul_vlaar at isc.org
Tue Mar 10 10:54:50 EDT 2009


Hi Kenneth,

Thanks for your response. My scrip is indeed looking for a "create"
transaction because it should only trigger at the time of creation, and
the CF value is rather static, as it applies to the Group that the Queue
in which the ticket belongs, has rights to. I realise now that finding
that relationship is a bit difficult, and it's probably better to move
the custom field to the Queue, instead.

	~paul

On Wed Mar 04 2009 19:39:09 GMT+0100 (CET), Kenneth Crocker wrote:
> 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
>>
> 
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
> 
> 
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com


-- 
Paul_Vlaar at isc.org - ISC Operations - +1 650 423 1349 - PGP 0x294EC062



More information about the rt-users mailing list