Perl way to select Queues based on condition (4.0.2)

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…

Hi,

I’m not sure what you mean. Sounds like you want a hash to map values
in one set to values in other set.

Something like this:

my %map = (
‘level’ => ‘queue’,

);

my $qname = $map{ $level };On Thu, Oct 20, 2011 at 12:40 AM, Srikumar Nair srikumarp@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

Best regards, Ruslan.

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
LBNLOn Wed, Oct 19, 2011 at 1:40 PM, Srikumar Nair srikumarp@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