Flow designer For each loop ask for approval

Sheryl Lyke2
Tera Guru

I'm having an issue getting an ask for approval action within a for each loop to work. Within a flow I've created, I'm calling a custom action that is returning an array of sys_user_group sys_ids. I want to loop through the array and ask for approval from each of the groups. Within the for each loop, I'm setting a flow variable to one of the sys ids from the array. This is getting set correctly. Then I'm using a scripted rule within the ask for approval action

 

var groups = fd_data.flow_var.group_sys_ids;
return "ApprovesRejectsAnyG["+groups+"]";

 

I can see in the execution results that the flow variable is getting set to one of the group sys_ids and the approval rule is pulling in that sys_id. But the approval records aren't getting inserted and the Approval state says skipped. 

 

Can someone provide guidance on how I can get the approval to trigger for each group? 

4 REPLIES 4

SanjivMeher
Kilo Patron
Kilo Patron

I am not sure what's going on. But can you add to line 7 below and try

var groups = your variable + "";


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

Thanks for the response, I've added this but got the same results

Tai Vu
Kilo Patron
Kilo Patron

Hi @Sheryl Lyke2 

Let's try this way.

TaiVu_0-1698811189253.png

 

Cheers,

Tai Vu

Tai Vu, thanks so much for the response. I ended up having to go a different route as I was under a time crunch.