Flow Designer approval problem using a For Each loop

Sergio26
Giga Guru

Hello,

I'm working on a flow and I have a problem understanding the approval logic logic when used in a For Each loop action.

I have a record producer (on the 'facilities_request' table) with a list collector variable which contains a list of locations (reference to the 'cmn_location table').

In the catalog form, the user can select locations for which he wants an access to granted on his employye card. When the request is created a task is created for each location and an approval is sent to the location owner to approve or not the access.

1- My first step is to get the selected locations in the variable. I'm doing this by a custom script action and I output the sys_id of each locations.

2- Then I look up for each record on the 'cmn_location' using those sys_id. 

3- Then I use a For Each loop action to create a facilities task for each location access.

When I'm doing this and test it everything is fine and I get one task for each location selected.

However when I include a 'Ask for approval' action after the task creation, there is only the first task that is created with the correct approver but the other tasks are not created.

The approval on the first task needs to be approved/refused and only then the second task is created with the correct approver and so on.

find_real_file.png

My goal is to create all the tasks with the approvals at the same time.

Anyone can help me?

Thank you

1 ACCEPTED SOLUTION

ServiceNow Tec2
Mega Sage
This has been resolved by ServiceNow Technical Support. Please refer to KB0762101 for more information.

View solution in original post

7 REPLIES 7

Jose Ferreira
Tera Contributor

I have this exact same problem.. Also looking for an answer to this.

ServiceNow Tec2
Mega Sage
This has been resolved by ServiceNow Technical Support. Please refer to KB0762101 for more information.

Hello ServiceNow Technical Support,

I created a Case on HI and a support engineer worked with me on my use case and problem and it resulted that this is not acheivable with Flow Designer.

The KB your are refering to is for the action 'Do the following in parallel' and it does not apply for what I'm trying to acheive.

Thank you

Mark Branscombe
Tera Contributor

Late reply, but just ran into the same problem. A workaround is to create the tasks only in the For Each loop, then call a Sub-Flow to create the approvals. 

 

Importantly ensure 'Wait For Completion' is false in the sub-flow.