[rt-users] Custom Field - Yes / No Option
Landon Stewart
lstewart at iweb.com
Fri Oct 11 15:47:50 EDT 2013
On 11 October 2013 03:54, globo <michael.obrien at globoforce.com> 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 :: lstewart at iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com :: +1 (888) 909-4932
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20131011/ebb9f089/attachment.htm>
More information about the rt-users
mailing list