Moving tickets from many queues to one

I’m trying to write up a Perl script to move all tickets from a group of
queues into one larger queue. I’m having some difficulty figuring out
how to get a list of tickets in a queue. This seems so basic, maybe I’m
thinking too hard about it.

Anyways, here’s what I have so far. The lines with a “#” in front is
my attempt to describe what I want to do. Maybe I’m thinking about this
backwards.

my $destqueue = RT::Queue->new($RT::SystemUser);
$destqueue->Load('bigqueue');

foreach $smallqueue (@smallqueues) {

my $sourcequeue = RT::Queue->new($RT::SystemUser);
$sourcequeue->Load($smallqueue);

my $Tickets = RT::Tickets->new($RT::SystemUser);

@tickets = $Tickets->ListAllInQueue($sourcequeue->id);

foreach $ticket (@tickets) {

$ticket->SetQueue($destqueue->id);

}

}

Any help or pointers would be appreciated.

-Grant Miller grant@pico.apple.com

Unix Systems Admin, Engineering Computer Services, Apple Computer

I’m trying to write up a Perl script to move all tickets from a group of
queues into one larger queue. I’m having some difficulty figuring out
how to get a list of tickets in a queue. This seems so basic, maybe I’m
thinking too hard about it.

For examples and whatnot, have a look at the cli ‘rt’ thats comes with RT.

my $sourcequeue = RT::Queue->new($RT::SystemUser);
$sourcequeue->Load($smallqueue);

my $Tickets = RT::Tickets->new($RT::SystemUser);

$Tickets->UnLimit();
$Tickets->LimitQueue( VALUE => $sourcequeue->Name,
			OPERATOR => '=' );

while( my $ticket = $Tickets->Next() ){

$ticket->SetQueue($destqueue->id);

}

}
                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B             Operations/Security