<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>Strip the requestor - Assign to queue</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Thanks everyone for yor help. Th</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">e</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">following</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> will take a ticket based on the conditions you specify in the prep code $match string and then identify t</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">he</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">‘</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">Requestors</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">’</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">, remove them, assign it to the queue you want and change the owner to whomever you desire.</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Hope it helps.</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<BR>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">This is what I did:</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Description = Whatever</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Condition = On Create</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Action = User Defined</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Template = Black</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Stage = TransactionCreate</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Prep Code:</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">my $match = "^</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"><INSERT STRING HERE></FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">";</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">my $t_subject = $self->TicketObj->Subject;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">if ( $t_subject !~ /$match/ ) {</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri"> return 0;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">}</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">else {</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri"> return 1;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">}</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Cleanup Code:</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">my $newqueue = "</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"><QUEUE></FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">";</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">my $newSystemUser = "</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"><WH</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">O</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">EVER></FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">";</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">my $T_Obj = $self->TicketObj;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">my $requestor = $self->TicketObj->RequestorAddresses; </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">my @watchers = split /\,/,$requestor; </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">$RT::Logger->warning("Scrip</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">145</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> found watchers: </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">$requestor"); </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">foreach my $watcher (@watchers) { </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">my ($status, $msg) = </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">$self->TicketObj->DeleteWatcher(Type=>'Requestor',Email=>$watcher); </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">} </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">$RT::Logger->info("Auto assign ticket #". $T_Obj->id ." to queue #". $newqueue );</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">my ($status, $msg) = $T_Obj->SetQueue($newqueue);</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">unless ($status) {</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri"> $RT::Logger->warning("unable to set new queue: $msg");</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri"> return undef;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">}</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">return 1;</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
</BODY>
</HTML>