Can values of Custom Field be based on Queue?

Hi All,

I’m trying to find to way to get this requirement work.

We have multiple queues in RT, like queueA, queueB, queueC. All queues are
using the same Custom Field that applied to them. One of those Custom
Fields is called Customer, which is using external values from a REST API.
What we want is in different queue, this Customer filed should shows
different drop-down list for user to select.

Can this be done? It’s quite a reasonable requirement. Any thought would be
appreciated, thank you.

BR,
Chrilly

Hi All,

I’m trying to find to way to get this requirement work.

We have multiple queues in RT, like queueA, queueB, queueC. All queues are
using the same Custom Field that applied to them. One of those Custom Fields
is called Customer, which is using external values from a REST API. What we
want is in different queue, this Customer filed should shows different
drop-down list for user to select.

Can this be done?

Kind of…

Have separate CFs each named Customer and apply each to their
respective queue. Then populate those CFs with the values you’d like.

We do this with a CF named ‘Problem Type’. We put the queue name in
the Description field of the CF so we can get a sense of what queue
the CF is applied to when viewing the CF details.

The CFs won’t be global, but they’ll each have the same name, so code
that is queue specific will load the correct Customer CF and thus the
correct values for the CF.

The other solutions for this problem involve more JS and AJAXy code.

-m

Hi All,

I’m trying to find to way to get this requirement work.

We have multiple queues in RT, like queueA, queueB, queueC. All queues are
using the same Custom Field that applied to them. One of those Custom Fields
is called Customer, which is using external values from a REST API. What we
want is in different queue, this Customer filed should shows different
drop-down list for user to select.

Can this be done?

Kind of…

Have separate CFs each named Customer and apply each to their
respective queue. Then populate those CFs with the values you’d like.

We do this with a CF named ‘Problem Type’. We put the queue name in
the Description field of the CF so we can get a sense of what queue
the CF is applied to when viewing the CF details.

The CFs won’t be global, but they’ll each have the same name, so code
that is queue specific will load the correct Customer CF and thus the
correct values for the CF.

The other solutions for this problem involve more JS and AJAXy code.

If you use RT 4.2.10 or later this can easily be done (see [1]).

In you ExternalValues method within your RT::CustomFieldValues::???
package put this:

my $queue = $self->CustomFieldObject->ContextObject->QueueObj;

to get a RT::Queue object.
You can then return different values based on the Queue id or name.
I would prefer to use the Queue id instead of the Name as the later one
can easily be changed in the WebUI.
If you just want the Queue Id you can put this instead of the above in
your method:

my $queue_id = $self->CustomFieldObject->ContextObject->Queue;

because $self->CustomFieldObject->ContextObject is actually a RT::Ticket
object.

Chris

[1] https://github.com/bestpractical/rt/commit/a84b429