<div>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.</div>
<div> </div>
<div>For this, I have copied 'Autoreply' global template to the 'general' queue. </div>
<div> </div>
<div>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.</div>
<div> </div>
<div>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 ' <br>
</div>
<div>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.</div>
<div> </div>
<div>Any help & responses to this mailing will be appreciated!</div>
<div> </div>
<div>Example scrip for database in the "general" queue:</div>
<div>======================================</div>
<div>###<<Custom Action Prep Code>></div>
<div>my $data = 'database,mysql,sql,oracle,accounts,sqlserver,graddb';<br>my @match = split(',', $data);</div>
<div>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;</div>
<div> </div>
<div>###<<Custom Action Cleanup code>></div>
<div> </div>
<div>my $newqueue = "4";<br>my $newowner = "brian";<br>my $T_Obj = $self->TicketObj;</div>
<div>$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;<br></div>