[rt-users] How to get Custom Field's description which setted by ExternalValues subroutine

Parish, Brent bparish at cognex.com
Tue Oct 8 16:16:26 EDT 2013


Hi.

I'm writing a scrip.
In that scrip, I have no trouble getting the value of a custom field that the user set.
I get the value with:  $CF_Value = $self->TicketObj->FirstCustomFieldValue( 'Colors' );

But I don't know how to get the content from the Description value for that same field?
To be clear:  I want the description associated with the VALUE set in that CustomField, NOT the Description of the CustomField itself.

In other words, if MyCustomFieldName is a "Select One Value" type of CustomField, and some of the values look like this:

Name = "red"     Description = "Red is a lovely color"
Name = "blue"    Description = "Blue is nice too"

Inside the scrip I want to read that Description field.  E.g. I need to set a variable to "Blue is nice too", if the user has selected "blue" for the customfield called 'Colors'.

Many thanks!
Brent



Ruslan Zakirov<http://www.mail-archive.com/search?l=rt-users@lists.bestpractical.com&q=from:%22Ruslan+Zakirov%22> Wed, 22 May 2013 03:45:32 -0700<http://www.mail-archive.com/search?l=rt-users@lists.bestpractical.com&q=date:20130522>

Hi,



This is description of a value that is not stored along with value on the

ticket or other object value is set on. The only way is to get list of

values, find one that was set on the object and get description. External

Custom Field Values are very sensitive to methods called on collection or

record, so you have to be careful.




chrilde at gmail    May 21, 2013, 5:54 AM


Hi All,

I've got a problem with the Custom Field description issue. I created a
custom field named Contact, and when a new ticket is created, I use scrip
to add this Contact user to Requestor list.
I remember that when we set the ExternalValues with code below, we would
pass a description to RT
sub ExternalValues {
..........
..........
push @res, {
name => $element->{'cont_name'},
description => $element->{'cont_email'},
sortorder => $i++,
};
..........
}

So i want to use this "description" value to create user or add to mail
list. Can anyone tell me how to get it?

I used code as listed below, but what i got is just the Description value
of this Custom Field, NOT the description of the custom field value I
passed in config file.

my $CF = new RT::CustomField($RT::SystemUser);
$CF->LoadByName( Queue => $ticket->QueueObj->id, Name => $CFName );
$Email = $CF->Description();

Any suggestions would be help, thanks a lot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20131008/2a03d3de/attachment.htm>


More information about the rt-users mailing list