[rt-users] round-robin auto assignment?
Todd Chapman
rt at chaka.net
Tue Dec 28 17:16:58 EST 2004
Try:
$Transaction->TicketObj->SetOwner
On Tue, Dec 28, 2004 at 01:47:17PM -0800, matthew zeier wrote:
>
> I've done a little more work on this with Chance (scrip below). We're
> getting the following error with $Ticket:
>
>
> [Tue Dec 28 21:45:58 2004] [error]: Scrip 57 Prepare failed: Global symbol
> "$Ticket" requires explicit package name at (eval 2333) line 6.
> Global symbol "$Ticket" requires explicit package name at (eval 2333) line
> 18.
> Global symbol "$Ticket" requires explicit package name at (eval 2333) line
> 24.
> syntax error at (eval 2333) line 24, near "->SetOwner["
> (/opt/rt3/lib/RT/Action/UserDefined.pm:65)
>
>
> How do I refer to the current ticket?
>
> ----
>
> my @owners = qw( 2306 904 1880 ); #could create a group for this
> push(@owners, @owners);
>
> my $tickets = RT::Tickets->new($RT::System);
> $tickets->LimitQueue(VALUE => 'ICI Internal');
> $tickets->LimitId(VALUE => $Ticket->Id, OPERATOR => '!=');
> $tickets->OrderBy( FIELD => 'id', ORDER => 'DESC' );
> my $last_ticket = $tickets->First;
> my $last_owner = $last_ticket->Owner->Id;
>
> my $i = 0;
> my $isSet = 0;
> my $new_owner;
>
> foreach $i ( @owners) {
> if ($owners[$i] == $last_owner) {
> $new_owner = $owners[$i+1];
> $Ticket->SetOwner($new_owner);
> $isSet = 1;
> }
> }
>
> if (!($isSet)) {
> $Ticket->SetOwner[int(rand($#owners))];
> }
>
> _______________________________________________
> 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