Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Flow Designer Scripted Approvals in sent in Parallel

zacharyjacobs
Tera Contributor

I have a service catalog that allows our organization to submit requests for users to obtain access to ServiceNow via assignment group. Each assignment group has a different manager that must provide their approval before the user is granted SNOW access.

 

My form is very simple. It has a first name last name field. It has a list of ServiceNow assignment groups that the submitter will choose that the new user shall be part of.

 

I first convert the list collector for the approval groups to an array. Then use a for loop to iterate over each selected group. I then use the scripted approval to look up the manager and return in the field for ApprovesRejectsAnyU. 

 

The problem I am having is that the for loop does not continue to the next iteration until an approval is approved/rejected, the flow simply says "waiting". I need the approvals to all be sent in parallel.

 

My Flow designer code is as follows for scripted approval action:

 

var tmp = fd_data.flow_var.tmp_snow_group;
var gr = new GlideRecord('sys_user_group');
gr.addQuery('sys_id', tmp);
gr.query();

while (gr.next()){
return "ApprovesRejectsAnyU["+gr.getValue('u_manager')+"]";
}
0 REPLIES 0