Various approvers - advanced approval script

Hannah C
Giga Expert

Hi there!

I am trying to write a script on an Approver activity in a workflow. On the catalog item, a user will select a group on the variable GroupName. If the group has a manager, I want the group manager to be the approver. If there is no group manager, I want the Business Service Owner to be the approver. If the group does not have a manager or a Business Service Owner, I have 3 specific people I want to be the approvers but only one needs to approve. Here is what I have been trying and it does work when the group has a manager but after that it is not working

 

var answer = [];

if (current.variables.GroupName.manager != '')
{answer.push (current.variables.GroupName.manager.sys_id.toString());}

else if (current.variables.GroupName.business_service_ownerDONOTUSE != '')
{answer.push(current.variables.GroupName.business_service_ownerDONOTUSE.sys_id.toString());}

else
{answer.push('13ece655db949340b3613caf9d9619f6');
answer.push('5bec2a55db949340b3613caf9d961948');
answer.push('5fec2a55db949340b3613caf9d961919');}

 

On the last else statement, those are the sys ids of the three people to be the approvers if no manager and no business service owner

17 REPLIES 17

There are a lot of transactions being cancelled like these:

Cancelling transaction #425804 /xmlhttp.do (cancelled by other transaction): Thread Default-thread-5 (H304501, 087D8A85DBFFDB0092773220AD961909), after 462ms

 

Cancelling unclaimed (waiting) transaction #425806 /xmlhttp.do (cancelled by other transaction): Thread (H304501, 087D8A85DBFFDB0092773220AD961909), after 324ms

Search for message with +++++ in the log


Please mark this response as correct or helpful if it assisted you with your question.

find_real_file.png