[rt-users] Strip the requestor - Assign to queue
Randy Black
Randy.Black at Buckle.com
Thu Jan 5 17:07:17 EST 2012
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;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120105/37c1cadb/attachment.htm>
More information about the rt-users
mailing list