<p>All RT tickets are generated in the 'general' queue i.e. users want to send all requests to <a href="mailto:rt@sunysb.edu">rt@sunysb.edu</a>. Before the auto response is sent to the requestor, I want to assign the ticket to an appropriate queue and owner.<br>
 <br>For this, I have copied 'Autoreply' global template to the 'general' queue. <br> <br>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 (<a href="mailto:rt-web@sunysb.edu">rt-web@sunysb.edu</a>); 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.<br>
 <br>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 ' </p>

<p>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.<br> <br>Any help and responses to this mailing will be appreciated!<br>
 <br>Example scrip for database in the "general" queue:<br>======================================<br>###<<Custom Action Prep Code>><br>my $data = 'database,mysql,sql,oracle,accounts,sqlserver,graddb';<br>
my @match = split(',', $data);<br>my $t_subject = $self->TicketObj->Subject;<br>foreach my $val (@match) {<br>  if ($t_subject =~ /^${val}\W/i ||<br>      $t_subject =~ /\W${val}\W/i ||<br>      $t_subject =~ /\W${val}$/i)<br>
  {<br>     return 1;<br>  }<br>}<br> return 0;<br> <br>###<<Custom Action Cleanup code>><br> <br>my $newqueue = "4";<br>my $newowner = "brian";<br>my $T_Obj = $self->TicketObj;<br>$RT::Logger->info("Auto assign ticket #". $T_Obj->id ." to queue #". $newqueue );<br>
my ($status, $msg) = $T_Obj->SetQueue($newqueue);<br>unless ($status) {<br>    $RT::Logger->warning("unable to set new queue: $msg");<br>    return undef;<br>}<br>$RT::Logger->info("Auto assign ticket #". $T_Obj->id ." to user #". $newowner );<br>
my ($status, $msg) = $self->TicketObj->SetOwner( $newowner );<br>unless( $status ) {<br>    $RT::Logger->error( "Impossible to assign the ticket to $newowner: $msg" );<br>    return undef;<br>}<br>return 1;</p>