<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Testwreq,<br>
<br>
I do the same thing, only I use a Custom Field called "CFO-Org". When a
ticket is created, that CF MUST be selected and based on that value, I
pre-assign the ticket owner. It looks like this:<br>
<br>
Condition: On Create<br>
Action: User-defined<br>
<br>
Custom Prep Code:<br>
<br>
my $trans = $self->TransactionObj;<br>
my $ticket = $self->TicketObj;<br>
<br>
#<br>
# set new ticket owner id value<br>
#<br>
#    42 - Bob<br>
#   148 - Carole<br>
#  5125 -  Ted <br>
#  9324 - Alice<br>
# 73886 -  Frank <br>
#<br>
<br>
my %orgs = qw(<br>
           Budget-Direct   148<br>
           Budget-Indirect 148<br>
           Controller-AP   5125<br>
           Controller-AR   73886<br>
           Controller-GA   148<br>
           Controller-PR   42<br>
           Facilities      42<br>
           Field OPS       42<br>
           OCFO-Other      42<br>
           Procurement     9324<br>
           Property        9324<br>
           SPO             73886<br>
           Travel          5125<br>
           Other           42<br>
          );<br>
<br>
my $cf = new RT::CustomField($RT::SystemUser);<br>
$cf->LoadByName(Queue => $ticket->QueueObj->id,Name =>
"CFO-Org");<br>
return 0 unless $cf->id;<br>
my $cfvalue = $ticket->FirstCustomFieldValue('CFO-Org');  <br>
my $ownerid = $orgs{$cfvalue};<br>
<br>
# set Ticket Owner ID<br>
<br>
$ticket->SetOwner($ownerid);<br>
<br>
return 1;<br>
<br>
Custom Clean-up Code:<br>
<br>
return 1;<br>
<br>
I hope this helps.<br>
<br>
Kenn<br>
LBNL<br>
<br>
On 7/17/2009 8:19 AM, testwreq wreq wrote:
<blockquote
 cite="mid:a0c34f0a0907170819t25ba5f87q55b0c9cca775732c@mail.gmail.com"
 type="cite">
  <div>All RT tickets are generated in the 'general' queue i.e. users
want to send all requests to <a moz-do-not-send="true"
 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 moz-do-not-send="true"
 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>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
<a class="moz-txt-link-freetext" href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</a>

Community help: <a class="moz-txt-link-freetext" href="http://wiki.bestpractical.com">http://wiki.bestpractical.com</a>
Commercial support: <a class="moz-txt-link-abbreviated" href="mailto:sales@bestpractical.com">sales@bestpractical.com</a>


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at <a class="moz-txt-link-freetext" href="http://rtbook.bestpractical.com">http://rtbook.bestpractical.com</a></pre>
</blockquote>
</body>
</html>