[rt-users] round-robin auto assignment?

Todd Chapman rt at chaka.net
Wed Dec 15 17:17:54 EST 2004


The scrip needs to figure out the last ticket created in the
queue, figure out who it was assigned to, and then assign
to the next person in a list that is also stored in the
scrip.

Here is a start but there may be subtle bugs:

my @owners = qw( george sam bill fred ); #could create a group for this
push(@owners, @owners);

my $tickets = RT::Tickets->new($RT::System);
$tickets->LimitQueue(VALUE => 'my queue');
$tickets->LimitId(VALUE => $Ticket->Id, OPERATOR => '!=');
$tickets->OrderBy( FIELD => 'id', ORDER => 'DESC' );
my $last_ticket = $tickets->First;
my $last_owner = $last_ticket->Owner->Name;

my $i = 0;
my $new_owner;

while (1) {
    if ($owners[$i] eq $last_owner) {
        $new_owner = $owners[$i+1];
        $Ticket->SetOwner($new_owner);
        last;
    }
}

On Wed, Dec 15, 2004 at 01:30:02PM -0800, matthew zeier wrote:
> 
> Would like to auto assign incoming "sales" tickets amongst users in the 
> "sales" group.  I imagine that's possible with an On-Create but I'm not 
> sure what that code would look like.
> 
> Has anyone already invented this wheel? 
> 
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Be sure to check out the RT wiki at http://wiki.bestpractical.com



More information about the rt-users mailing list