Get the selected value of a CustomField with a Script

Hello,

I have a ticket with some Custom Fields.

I wrote a scrip and i need to read the Custom Fields values,
but i don’t find the command.

For example, if i have a CF myCF(combobox) with values ( red, orange, green),
and user select a value ( red )

What command on my script i can use to get the selected value ?

I look for something like that:
$myColor = $myCF->getSelectedValue;

now $myColor has ‘red’

Tanks best regards.

Marco

Hello,

I have a ticket with some Custom Fields.

I wrote a scrip and i need to read the Custom Fields values,
but i don’t find the command.

For example, if i have a CF myCF(combobox) with values ( red, orange,
green),
and user select a value ( red )

What command on my script i can use to get the selected value ?

$self->TicketObj->FirstCustomFieldValue(myCF);

Marco,

Try “$Ticket->FirstCustomFieldValue(‘Name of CF’)” for templates and
“$self->TicketObj->FirstCustomFieldValue(‘Name of CF’)” for scrips.

I believe there is an example in the book.

Kenn
LBNLOn Tue, Sep 7, 2010 at 8:51 AM, Marco.deSousa@billag.com wrote:

Hello,

I have a ticket with some Custom Fields.

I wrote a scrip and i need to read the Custom Fields values,
but i don’t find the command.

For example, if i have a CF myCF(combobox) with values ( red, orange,
green),
and user select a value ( red )

What command on my script i can use to get the selected value ?

I look for something like that:
$myColor = $myCF->getSelectedValue;

now $myColor has ‘red’

Tanks best regards.

Marco

RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of RT!

Hello Kenn,

Tanks, code work good !

Have a nice Day !

Marco.From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kenneth Crocker
Sent: Tuesday, September 07, 2010 6:16 PM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Get the selected value of a CustomField with a Script

Marco,

Try “$Ticket->FirstCustomFieldValue(‘Name of CF’)” for templates and
“$self->TicketObj->FirstCustomFieldValue(‘Name of CF’)” for scrips.

I believe there is an example in the book.

Kenn
LBNL