Thanks everyone for yor help.  The following will take a ticket based on
the conditions you specify in the prep code $match string and then
identify the 'Requestors', remove them, assign it to the queue you want
and change the owner to whomever you desire.

Hope it helps.


This is what I did:

Description = Whatever
Condition = On Create
Action = User Defined
Template = Black
Stage = TransactionCreate

Prep Code:
my $match = "^<INSERT STRING HERE>";
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject !~ /$match/ ) {
   return 0;
}
else {
   return 1;
}

Cleanup Code:
my $newqueue = "<QUEUE>";
my $newSystemUser = "<WHOEVER>";
my $T_Obj = $self->TicketObj;
my $requestor = $self->TicketObj->RequestorAddresses; 
my @watchers = split /\,/,$requestor; 

$RT::Logger->warning("Scrip 145 found watchers: 
$requestor"); 

foreach my $watcher (@watchers) { 
my ($status, $msg) = 
$self->TicketObj->DeleteWatcher(Type=>'Requestor',Email=>$watcher); 
} 

$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;
}

return 1;
--------
RT Training Sessions (http://bestpractical.com/services/training.html)
* Boston — March 5 & 6, 2012

Reply via email to