Hey Jordan,
On Wed, Feb 10, 2016 at 4:56 AM, Jordan Taylor via rt-users
<[email protected]> wrote:
>
>> 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');
The code looks sensible. Try adding some logging to see what is going on:
RT->Logger->error($cfvalue);
>> my $ownerid = $orgs{$cfvalue};
RT->Logger->error($ownerid);
>> # set Ticket Due date & Owner ID
>>
>> $ticket->SetOwner($ownerid);
>>
>> return 1;
Cheers,
-m
---------
RT 4.4 and RTIR Training Sessions
(http://bestpractical.com/services/training.html)
* Hamburg Germany March 14 & 15, 2016