[rt-users] Problem on auto assigning tickets after creating to users

Ajai Kumar joinajay1 at gmail.com
Thu Jun 18 04:28:59 EDT 2015


Dear All,
Thanks for support in advance.Please refer appended script,which is
working  fine for one queue  and same script is not working for other queue
in the same rt system. The domain name are different,however coming to same
RT system. Can some one help on this issue pls.
......................................
Condition: On create

Action: user defined
Custom condition:return 1;

Custom action preparation code:

my @owners = qw(90 92 128); # need to grab id from Users table 128  @owners
push(@owners, @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);
}

Regards,
Ajai Kumar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20150618/78476900/attachment.html>


More information about the rt-users mailing list