[rt-users] Perl way to select Queues based on condition (4.0.2).

Kenneth Crocker kfcrocker at lbl.gov
Mon Oct 24 15:00:33 EDT 2011


Srikumar,

You could possibly use something like this:

# set basic values

my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;

#
# set new ticket Queue id value
#
#        1 - Queue 1
#        2-  Queue 2
#

my %lvls = qw(
           Support1   1
           Support2   2
          );

my $cf = new RT::CustomField($RT::SystemUser);
$cf->LoadByName(Queue => $ticket->QueueObj->id,Name => "Support Level");

# check for valid Support Level value first,
# then set new Ticket Queue ID

if ($cf->id)
    {
     my $cfvalue = $ticket->FirstCustomFieldValue('Support Level');
     my $queueid = $lvls{$cfvalue};
     $ticket->SetQueue($queueid);
    }

return 1;

Obviously, you will have different values for your CF "Support Level", but I
think this will give yoiu an idea of how it works.

Hope it helps.

Kenn
LBNL

On Wed, Oct 19, 2011 at 1:40 PM, Srikumar Nair <srikumarp at fb.com> wrote:

>  I have a Custom Field on the Queue object called 'Support Level' with
> various support levels (Different Queue for different support levels)
> How can I choose the Queue (with Perl APIs) based on the Support Level I
> receive as input?
>
>  I want to assign the Ticket to the correct queue during Ticket creation
> (BTW, I create Tickets with Perl APIs).
>
>  Does any one has some Perl code snippets that uses the RT APIs?
>
>  Thanks a bunch..
>
>
> --------
> RT Training Sessions (http://bestpractical.com/services/training.html)
> *  Washington DC, USA — October 31 & November 1, 2011
> *  Barcelona, Spain — November 28 & 29, 2011
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20111024/0ebd2359/attachment.htm>


More information about the rt-users mailing list