Wikia

Request Tracker Wiki

SetOwnerAndQueueBySubject

Comments0
857pages on
this wiki

Not too fancy. Used the ideas from AutoSetOwner and AutomaticCustomFieldValue to send certain subject lines off to a specific queue and user.

Condition: On Create

Action: User Defined

Template: Global Template: Blank

Stage: Transaction Create

Custom Action Prep Code:

my $match = "some special regex";
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject !~ /$match/i ) {
   return 0;
}
else {
   return 1;
}

Custom Action Cleanup Code:

my $newqueue = "some_queue_number";
my $newowner = "some_owner";
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;

Hope this helps.

Dan Dofton, Four County Library System, ddofton@4cls.org

We made some changes to this script to receive QUEUE:OWNER on the email subject and set this values.

Condition: On Create
Action: User Defined
Template: Global Template: Blank
Stage: Transaction Create

Custom Action Prep Code:

my $match = ":";
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject !~ /$match/i ) {
  return 0;
}
else {
  return 1;
}

Custom Action Cleanup Code:

my $t_subject = $self->TicketObj->Subject;
my $newqueue;
my $newowner;
($newqueue,$newowner) = split(/:/,$t_subject);
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;

hope this help!

Thanks!

Christian - ccibelli at topgroup dot com dot ar

Around Wikia's network

Random Wiki