Setting ticket owner automatically

I have a queue that only one user is responsible for any ticket that
goes to that queue. I’d like to set a scrip that sets the owner to that
user on creation. I tried to create one that was user defined, with
template blank, and Custom action preparation code: set owner = ‘userid’;

it didn’t work. pointers?

Anne

I’d like to set a scrip that sets the owner to that user on creation.

Create a new scrip for that queue as follows:

Condition: OnCreate
Action: User Defined
Template: Global template: Blank
Stage: Transaction Create
Custom Condition:
Custom action prep. code: return 1;
Custom action cleanup code:

get actor ID

my $User = new RT::User($RT::SystemUser);

Put the email address of the user who needs to own tickets in this

queue in here!
$User->LoadByEmail(“user@domain.tld”);

my $Actor = $User->id;

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->warning( “Impossible to assign tickt to $Actor: $msg”
);
return undef;
}
return 1;

Hope that’s helpful.

Cheers

Alex Harrington - IT Support, Longhill High School

t: 01273 304086 | e: alex@longhill.org.uk