Testwreq,
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:
Condition: On Create
Action: User-defined
Custom Prep Code:
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
#
# set new ticket owner id value
#
# 42 - Bob
# 148 - Carole
# 5125 - Ted
# 9324 - Alice
# 73886 - Frank
#
my %orgs = qw(
Budget-Direct 148
Budget-Indirect 148
Controller-AP 5125
Controller-AR 73886
Controller-GA 148
Controller-PR 42
Facilities 42
Field OPS 42
OCFO-Other 42
Procurement 9324
Property 9324
SPO 73886
Travel 5125
Other 42
);
my $cf = new RT::CustomField($RT::SystemUser);
$cf->LoadByName(Queue => $ticket->QueueObj->id,Name => "CFO-Org");
return 0 unless $cf->id;
my $cfvalue = $ticket->FirstCustomFieldValue('CFO-Org');
my $ownerid = $orgs{$cfvalue};
# set Ticket Owner ID
$ticket->SetOwner($ownerid);
return 1;
Custom Clean-up Code:
return 1;
I hope this helps.
Kenn
LBNL
On 7/17/2009 8:19 AM, testwreq wreq wrote:
All RT tickets are generated in the 'general' queue i.e. users want to
send all requests to r...@sunysb.edu <mailto:r...@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-...@sunysb.edu <mailto:rt-...@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;
------------------------------------------------------------------------
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com