[rt-users] Auto-setting the owner of "child" tickets

Kevin Falcone falcone at bestpractical.com
Wed Aug 17 11:04:33 EDT 2011


On Tue, Aug 16, 2011 at 11:45:39AM -0400, Chris Hall wrote:
> Hello all,
> 
> Awhile back I set up a custom global scrip to auto-set the owner of a ticket
> to the user like this:
> 
> On Create, action user defined, Global template: Blank, Stage
> TransactionCreate
> 
> Custom action preparation code:
> 
>  return 1;
> 
> Custom action cleanup code:
> # get actor ID
> my $Actor = $self->TransactionObj->Creator;
> 
> # if actor is RT_SystemUser then get out of here
> return 1 if $Actor == $RT::SystemUser->id;
> 
> # get out unless ticket owner is nobody
> return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;
> 
> # ok, try to change owner
> $RT::Logger->info("Auto assign ticket #". $self->TicketObj->id ." to user
> #".$Actor );
>   my ($status, $msg) = $self->TicketObj->SetOwner( $Actor );
> unless( $status ) {
>   $RT::Logger->error( "Impossible to assign the ticket to $Actor: $msg" );
>   return undef;
> }
> return 1;
> 
> Honestly this is a holdover from another scrip I have that changes the owner
> of a ticket to the user whenever the ticket is commented on.  This is
> working good except that it doesn't seem to work for child tickets.  They
> still inherit the parent's owner as their own.  Anybody know where this is
> going awry?


Are you creating the Create link from the Links box on Ticket Display?
I believe that sets an owner for you, so the owner won't be Nobody.
You'll need to amend your check to say if the owner is the parent's
owner OR nobody, then autoset the owner.


-kevin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110817/3321c52f/attachment.sig>


More information about the rt-users mailing list