<p dir="ltr">Hi all,</p>
<p dir="ltr">Any help here means alot! Im on the latest version of RT.</p>
<p dir="ltr">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.</p>
<p dir="ltr"> The example script that I have is as follows however it doesn’t work? ;</p>
<p dir="ltr">Â </p>
<p dir="ltr">#----------------------------------------------------------------------------Â <br>
# Custom action Preparation Code:Â <br>
#----------------------------------------------------------------------------Â <br>
#Â <br>
# set new ticket owner id value <br>
#Â <br>
# 42 - Frank <br>
# 148 - Bob <br>
# 5125 - Sally <br>
# 9324 - Roberta <br>
# 73886 - Ted <br>
#Â </p>
<p dir="ltr">my %orgs = qw(Â <br>
Budget-Direct 148Â <br>
Budget-Indirect 148Â <br>
Controller-AP 5125Â <br>
Controller-AR 73886Â <br>
Controller-GA 148Â <br>
Controller-PR 42Â <br>
Facilities 42Â <br>
Field OPS 42Â <br>
OCFO-Other 42Â <br>
Procurement 9324Â <br>
Property 9324Â <br>
SPO 73886Â <br>
Travel 5125Â <br>
Other 42Â <br>
);Â </p>
<p dir="ltr">my $cf = new RT::CustomField($RT::SystemUser);Â <br>
$cf->LoadByName(Queue => $ticket->QueueObj->id,Name => "CFO-Org");Â <br>
return 0 unless $cf->id;Â <br>
my $cfvalue = $ticket->FirstCustomFieldValue('CFO-Org');Â <br>
my $ownerid = $orgs{$cfvalue};Â </p>
<p dir="ltr"># set Ticket Due date & Owner IDÂ </p>
<p dir="ltr">$ticket->SetOwner($ownerid);Â </p>
<p dir="ltr">return 1;Â <br>
#----------------------------------------------------------------------------Â <br>
# Custom action Cleanup Code:Â <br>
#----------------------------------------------------------------------------Â </p>
<p dir="ltr">return 1;Â </p>
<p dir="ltr">Â <br>
Any help would mean a great deal,</p>
<p dir="ltr">Many Thanks,</p>
<p dir="ltr">Jordan</p>