Issue in round robin tickets

Dear All,

In my RT system we created a queue named “hostmaster” and assign one scrips
which is mentioned below but when we send mail then it’s show in untaken
list.

Need your help.

my @owners = qw( 90 92 128); # need to grab id from Users table 128 @owners
push(@owners, @owners);

my $tickets = RT::Tickets->new($RT::SystemUser);
$tickets->LimitQueue(VALUE => ‘hostmaster’); # my queue, yours may differ
$tickets->LimitId(VALUE => $self->TicketObj->Id, OPERATOR => ‘!=’);
$tickets->OrderBy( FIELD => ‘id’, ORDER => ‘DESC’ );
my $last_ticket = $tickets->First;
my $last_owner = $last_ticket->Owner;

my $i = 0;
my $isSet = 0;
my $new_owner;

foreach $i (@owners) {
if ($owners[$i] == $last_owner) {
$new_owner = $owners[$i+1];
$self->TicketObj->SetOwner($new_owner);
$isSet = 1;
}
}

if (!($isSet)) {
my $randOwner = int(rand($#owners));
$randOwner = $owners[$randOwner];
$self->TicketObj->SetOwner($randOwner);
}

Chandra Prakash
Sr Internet Resource Analyst