Accessing Custom Fields on a Ticket when Moving from Queue A to Queue B

We have a queue (Queue A) with some mandatory custom fields. Tickets created in this queue can be moved to Queue B, where the fields are NOT mandatory, because tickets can ALSO be assigned to this queue from the General queue (say, Queue C).

I have a little scrip to copy the mandatory fields to another custom field so that the values CAN be seen when in Queue B, if they existed (from Queue A).

The scrip runs “On Queue Change”. Example code:

my $fac = ($self->TicketObj->FirstCustomFieldValue(‘Facility’));

if ($fac) {
$self->TicketObj->AddCustomFieldValue (
Field => ‘Ops Mandatory Info’,
Value => “Facility: $fac”,
RecordTransaction => 1 );
} else {
$self->TicketObj->AddCustomFieldValue (
Field => ‘Ops Mandatory Info’,
Value => “Facility: (undefined)”,
RecordTransaction => 1 );
}

return 1;

This doesn’t work, because the queue being moved TO (Queue B) doesn’t see the custom field. The code works if the custom field is ALSO assigned to Queue B. Unfortunately, doing this causes various other problems (e.g. when assigning owners and other operations) since these ‘mandatory’ fields are not always present.

Is there a way to look up the values on the ticket for custom fields that ARE there, but are no longer part of the queue custom fields?

Note that there is a custom condition that only runs this code if the source queue is Queue A. And in fact, that said, I suppose I could try “saving” the CF values during that check, and using them in the commit code…hmmmm…

Yeah, so next question – how does one create a “global” value in the scrip Custom condition code that can later be used in the “custom action commit code”?

Tried moving ALL the code to the “Custom condition” section, and added the “viewable” (non-mandatory) CF to Queue A. This isn’t optimal, but I THOUGHT it would work, but it doesn’t seem to. Not sure why THAT is…

So, stumped…

Hi Matt.

to move ALL the affected code in the right section ist the way to handle this.

Did you put your code in “Custom action preparation code” or “Custom action commit code”? For me the preparation code works before the operation takes place in all of our cases.

Anyway, the three parts are just perl code executed at a defined time. So use it as needed. Maybe the names of the fields are a bit confusing, so don’t mind about :wink:

Just return the right bool to execute the next section.

regards, Andre.

Not sure how to put all the code in the same block, as I need the source and destination queues, and the code blocks for the Ticket object only reference the “current” queue (either from before the ticket is moved, or after). Thus, “saving” the values in the pre-condition block and then using those values in the commit seems reasonable?

As for your questions about where I put the code…see my original description (and the replies I made to myself)…

So, still looking for a solution…