[rt-users] auto assignment of queue and owner via autoreply template

testwreq wreq testwreq at gmail.com
Fri Jul 17 11:19:09 EDT 2009


All RT tickets are generated in the 'general' queue i.e. users want to send
all requests to rt at sunysb.edu. Before the auto response is sent to the
requestor, I want to assign the ticket to an appropriate queue and owner.

For this, I have copied 'Autoreply' global template to the 'general' queue.

I am new to perl & RT and was wondering if RT perl gurus help. I want to
accomplish writing if ..else... conditions to assign an owner and queue
based on subject within this autoreply template before an autoreply is
generated. One of the RT gurus had helped me to assign an owner to the web
queue, when tickets were generated for the web queue (rt-web at sunysb.edu);
Generally, a second notification is sent out for auto assignment of owner
but the suggested way by RT guru did not send the second notification.
Therefore, I would like accomplish this by using a local autoreply template.

For example.. to assign the ticket to the database queue, my search will be
on keywords like 'database,mysql,sql,oracle,accounts,sqlserver,graddb' ; For
network queue, my search will be based on keywords like  'network, power,
NTP, www, slow, port, timeout, dns, wireless, remote, nfs, vpn, net, subnet,
telecon, router, switch, ftp '
Currently, I have 6 scrips in the general queue that assigns queue and
owner. I would like to combine these together within the 'Autoreply'
template.

Any help & responses to this mailing will be appreciated!

Example scrip for database in the "general" queue:
======================================
###<<Custom Action Prep Code>>
my $data = 'database,mysql,sql,oracle,accounts,sqlserver,graddb';
my @match = split(',', $data);
my $t_subject = $self->TicketObj->Subject;
foreach my $val (@match) {
  if ($t_subject =~ /^${val}\W/i ||
      $t_subject =~ /\W${val}\W/i ||
      $t_subject =~ /\W${val}$/i)
  {
     return 1;
  }
}
 return 0;

###<<Custom Action Cleanup code>>

my $newqueue = "4";
my $newowner = "brian";
my $T_Obj = $self->TicketObj;
$RT::Logger->info("Auto assign ticket #". $T_Obj->id ." to queue #".
$newqueue );
my ($status, $msg) = $T_Obj->SetQueue($newqueue);
unless ($status) {
    $RT::Logger->warning("unable to set new queue: $msg");
    return undef;
}
$RT::Logger->info("Auto assign ticket #". $T_Obj->id ." to user #".
$newowner );
my ($status, $msg) = $self->TicketObj->SetOwner( $newowner );
unless( $status ) {
    $RT::Logger->error( "Impossible to assign the ticket to $newowner: $msg"
);
    return undef;
}
return 1;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090717/a9e2fb51/attachment.htm>


More information about the rt-users mailing list