[rt-users] FW: Getting custom field value AND description in a scrip

Brent Wiese bwiese at ElementPS.com
Wed Oct 30 20:06:56 EDT 2013


Hi.

In our RT setup, a user chooses a value from a drop down list (a custom field called ‘application’) to indicate what software they want help with when they submit a new ticket.
I set up a scrip that checks the value of that custom field  and moves the ticket into the appropriate queue (based on which application they need help with).
Instead of hard coding a mapping of each application value to a queue name, I’d like to put the name of the queue into the custom field description.

For example, the custom fields might look like this:

Sort        Name                                    Description         Category
0              Microsoft Word                helpdesk
0              Microsoft Excel                 helpdesk
0              SharePoint                          developers
0              PeopleSoft                         hr

If the user selected “SharePoint” as the application they wanted help with, the scrip would read the description field and see that it should move the ticket into the “developers” queue.

I’ve got everything working great with static mapping, I just can’t figure out a way to retrieve that Description within a scrip.

Has anyone done this before?

Thanks!
Brent

Yes, we do something very similar. If that CF is a single-select, then this code snip will do what you want. Unfortunately, mine is a multi-select and I can’t figure out how to iterate through all the values. I’ve posted the question with no response… This still works, but only uses the first value.

Anyways:
my $ticket = $self->TicketObj;
     my $cfINT = 9;
    my $value_obj = RT::CustomFieldValue->new( $ticket->CurrentUser );
    $value_obj->LoadByCols(CustomField => $cfINT, Name => $ticket->FirstCustomFieldValue($cfINT));
    my $descval = $value_obj->Description;

     if ($descval eq 'sharepoint') {
… do your code bits here
     } elsif ($descval eq '…’
… you get the idea

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20131031/b61a0d3d/attachment.htm>


More information about the rt-users mailing list