Auto-setting the owner of "child" tickets

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?

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