[rt-users] getting the current queue name and how to move the ticket to another queue?

Ruslan U. Zakirov cubic at acronis.ru
Thu Apr 29 04:31:36 EDT 2004

Read first chapter. It'll give you start point.

Swinkels, Marcel wrote:
> Hi Ruslan,
> sorry to bother you again. I tried to use the code you gave me:
> my $CurrentQueue;
> $CurrentQueue = $TicketObj->QueueObj->Name.
> $RT::Logger->info("Found queuename $CurrentQueue");
> But when I use that code, I get the following error:
> Apr 29 09:34:43 secsrv RT: Scrip 66 Prepare failed: Global symbol
> "$TicketObj" requires explicit package name at (eval 2067) line 43.
> (/opt/rt3/lib/RT/Action/UserDefined.pm:43)
> I used this code in a working script that already has the following
> declarations:
> my $IPaddress;
> my $UPCountrycode;
> my $CFNameRead = 'IPaddress'; 
> my $CFNameWrite = 'UPCountry';
> my $Ticket = $self->TicketObj;
> my $CustomFields = $Ticket->QueueObj->CustomFields();
> my $CF = RT::CustomField->new( $RT::SystemUser );
> Did I miss a declaration somewhere? I also tried to add ; or . "\n";,
> but none of these options seems to work.
> Regards,
> Marcel Swinkels
> chello abuse
> UPC Nederland
> mswinkels at upc.nl 
> -----Original Message-----
> From: Ruslan U. Zakirov [mailto:cubic at acronis.ru] 
> Sent: zaterdag 24 april 2004 15:12
> To: Swinkels, Marcel
> Cc: rt-users at lists.bestpractical.com
> Subject: Re: [rt-users] getting the current queue name and how to move
> the ticket to another queue?
> Swinkels, Marcel wrote:
>>despite reading the RTWiki pages I still don't know how I can get the 
>>name (not the number) of the queue in which the ticket is in, using 
>>scrip-code. I also cannot find how I can move the ticket from one 
>>queue to the other using the name of the queue.
> 1)
> my $CurrentQueueName = $TicketObj->QueueObj->Name.
> 2)
> my $QueueObj = RT::Queue->new( $self->CurrentUser ); $QueueObj->Load(
> 'ToQueueName' ); unless( $QueueObj->id ) {
> 	die "Can't load queue";
> }
> $TicketObj->SetQueue( $QueueObj->id );
>>What I want to do is the following. A ticket comes in, the IP address 
>>is filtered out and a query is made on the database to see to which 
>>country the IP address belongs. That output is stored in a 
>>customfield. That all works fine. I also know how to read the value of
>>a CF. Our queues are named like f.i. chello abuse AT, chello abuse NL 
>>etc. The CF contains the country code. Our pre-filtering is done by 
>>procmail, but because some people still mail to the wrong 
>>abuseaddress, it is possible that a complaint for chello.at gets into 
>>the chello abuse NL queue. Therefor I want to get the name of the 
>>current queue and regexp it to see if there's a match (countrycode AT 
>>= chello abuse AT?) If the ticket is in the wrong queue I want to move
>>it to the correct queue.
>>Can someone tell me how I can:
>>- get the name of the current queue into a variable
>>- move a ticket to another queue using the name of it
>>Thank you very much in advance for any response.
>>Marcel Swinkels
>>chello abuse
>>UPC Nederland
>>mswinkels at upc.nl _______________________________________________
>>RT Developer and Administrator training is coming to LA, DC and 
>>Frankfurt this spring and summer. 
>>Sign up early, as class space is limited.

More information about the rt-users mailing list