Scripting Custom conditions and actions

I need to create a scrip that when a ticket is autocxreated from email with
a specific word in the subject, it is moved to a specific queue.

In Pigeon language here are how it should work

Condition
If subject LIKE ‘pursuant’

Action
make queue = ‘Pursuant’

I’m a n00b when it comes to scripting, especially in RT. Any help would be
greatly appreciated.

Thanks
Tim Mahoney
Win Svr 2003 / RT 3.0.12 / Apache 1.33 / Perl 5.8.6 / MySQL 4.1.18

I’ve got the code written, but it’s not working. The scrip is based on
http://wiki.bestpractical.com/index.cgi?AutoSetOwner.

Description: AutoChangeQueue
Condition: On Create
Custom condition:
Action: User Defined
Custom action preparation code: return 1;
Custom action cleanup code:

get out unless subject is Pursuant

return 1 unless $self->TicketObj->Subject = ‘Pursuant’;

ok, try to change queue

$RT::Logger->info(“Auto transfer ticket #”. $self->TicketObj->id ." to the
Pursuant Queue" );
my ($status, $msg) = $self->TicketObj->SetQueue( ‘8’ );
unless( $status ) {
$RT::Logger->warning( “Impossible to change Queue” );
return undef;
}
return 1;

No history in the log to indicate it couldn’t change queue, so I’m thinking
the Subject condition failed. Thanks, Iris, for pointing me in the right
direction.

Thanks,
Tim
972-980-4991From: Brookes, Iris [mailto:Iris.Brookes@tdsecurities.com]
Sent: Thursday, September 15, 2005 4:19 PM
To: Mahoney, Tim
Subject: RE: [rt-users] Scripting Custom conditions and actions

Have a look at the code here:
 
http://wiki.bestpractical.com/index.cgi?AutoChangeQueue
 
Regards,
Iris Brookes

At Friday 9/16/2005 11:22 AM, Mahoney, Tim wrote:

I’ve got the code written, but it’s not working. The scrip is based on

get out unless subject is Pursuant

return 1 unless $self->TicketObj->Subject = ‘Pursuant’;

If you need to match when the subject contains ‘Pursuant’, you need this:

return 1 unless $self->TicketObj->Subject =~ /Pursuant/;

Steve