[rt-users] automatic take

Tim Cutts tjrc at sanger.ac.uk
Thu Sep 4 11:28:46 EDT 2008


On 4 Sep 2008, at 4:05 pm, Joshua N Pritikin wrote:

> Suppose there is a new unassigned ticket. Suppose I reply to the  
> ticket
> via email. Is there some way for my RT account to automatically take  
> the
> ticket? If so, how?


We have this set up.

You need to add a Scrip to do it.  We have a Global scrip called  
AutoTakeOnCorrespond, which has the following custom action.  You'll  
notice there are some parts of it (particularly the line about the  
syshelp queue) which are specific to our site, so you will want to  
change parts of it.

my $correspondent = $self->TransactionObj->Creator;

# don't auto-take for "root"
return 1 if $correspondent == $RT::SystemUser->id;

# only auto-take if owned by Nobody
return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;

# don't auto-take tickets in "syshelp"
return 1 if $self->TicketObj->QueueObj->Name eq 'syshelp';

# don't auto-take if correspondent is requestor
# see http://wiki.bestpractical.com/index.cgi?OnCreateSetDeptHeadCc
my $rgobj = $self->TicketObj->Requestors;
my $rmobj = $rgobj->UserMembersObj;
my $uobj;
while ($uobj = $rmobj->Next) {
   if ($uobj->PrincipalObj->Id == $correspondent) {
     $RT::Logger->info("Not auto-assigning ticket #" .  $self- 
 >TicketObj->id . " to its requestor");
     return 1;
   }
}

$RT::Logger->info("Auto assign ticket #". $self->TicketObj->id ." to  
user #". $correspondent );
my ($status, $msg) = $self->TicketObj->SetOwner( $correspondent );
unless( $status ) {
   $RT::Logger->error( "Impossible to assign ticket to $correspondent:  
$msg" );
   return undef;
}
return 1;



-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 



More information about the rt-users mailing list