Autoset owner by custom field value

Jordan Taylor jordantaylor781 at googlemail.com
Tue Feb 9 08:13:36 EST 2016


Hi all,

Any help here means alot! Im on the latest version of RT.

What I want to do is, I want the script to automatically set the owner
based on the custom field which there are a few users that need made owner
of certain values.

 The example script that I have is as follows however it doesn’t work? ;



#----------------------------------------------------------------------------
# Custom action Preparation Code:
#----------------------------------------------------------------------------
#
# set new ticket owner id value
#
# 42 - Frank
# 148 - Bob
# 5125 - Sally
# 9324 - Roberta
# 73886 - Ted
#

my %orgs = qw(
Budget-Direct 148
Budget-Indirect 148
Controller-AP 5125
Controller-AR 73886
Controller-GA 148
Controller-PR 42
Facilities 42
Field OPS 42
OCFO-Other 42
Procurement 9324
Property 9324
SPO 73886
Travel 5125
Other 42
);

my $cf = new RT::CustomField($RT::SystemUser);
$cf->LoadByName(Queue => $ticket->QueueObj->id,Name => "CFO-Org");
return 0 unless $cf->id;
my $cfvalue = $ticket->FirstCustomFieldValue('CFO-Org');
my $ownerid = $orgs{$cfvalue};

# set Ticket Due date & Owner ID

$ticket->SetOwner($ownerid);

return 1;
#----------------------------------------------------------------------------
# Custom action Cleanup Code:
#----------------------------------------------------------------------------

return 1;


Any help would mean a great deal,

Many Thanks,

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-devel/attachments/20160209/7c605650/attachment.html>


More information about the rt-devel mailing list