Skip to content

Instantly share code, notes, and snippets.

@lnaia
Last active August 29, 2015 13:56
Show Gist options
  • Save lnaia/9190156 to your computer and use it in GitHub Desktop.
Save lnaia/9190156 to your computer and use it in GitHub Desktop.
sub filterTicketsByQueue {
my $self = shift;
my $queue = shift;
my $current_user = new RT::CurrentUser;
$current_user->LoadByName('RT_System');
my $tickets = new RT::Tickets($current_user);
$tickets->LimitQueue(
"OPERATOR" => "=",
"VALUE" => $queue
);
$tickets->OrderBy( FIELD => 'id', ORDER => 'DESC' );
while (my $ticket = $tickets->Next) {
# do stuff
$RT::Logger->info($ticket->id);
}
return $tickets; # do stuff elsewhere
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment