On 11 October 2013 03:54, globo <[email protected]> wrote:

> Hi,
>
> I am trying to create a custom field with Yes / No options.
>
> If Yes is selected the custom Field would load a template and No won't load
> the template.
>
> I am using the following code in my script under Custom Condition
>
> Condition: User Defined
>
> $self->TicketObj->FirstCustomFieldValue("Custom Field Name") ne "Yes")
>
> I'm not a programmer so I am struggling to figure how to get this working.


In RT most of these things have to return something so RT knows something
was done or knows the condition is true.  This is true for conditions and
actions.

For the condition:
return 0 unless $self->TicketObj->FirstCustomFieldValue("Custom Field
Name") eq "Yes";
return 0 unless $self->TicketObj->FirstCustomFieldValue("Custom Field
Name") ne "";
return 1;

Or just simply a one liner (functionally the same as above):
return 1 if $self->TicketObj->FirstCustomFieldValue("Custom Field Name") eq
"Yes";

It'll return zero unless that custom field is set to Yes (case matters in
both examples).

-- 
Landon Stewart :: [email protected]
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com :: +1 (888) 909-4932

Reply via email to