How to avoid using for each in flow designer ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
I have a catalog in which , multiple users request a software or single user requests multiple softwares ,
in the flow i want a managers approval , if suppose three users were selected , then it should create three manager approvals , for which i did the lookup in sys_user table , there in the condition I have written a script
this script will fetch the sys_ids from the list collector type variable , then I have written a for each which will take each sys_id and it will create a approval record for it
once this approvals are created , when each approval is approved I want a task should be created ,
but here as I am using for each , its picking a random sys_id / picking in ascending order ,
until and unless i approve the approvals in order the next task generation is not happening as expected is there any way I can overcome this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago - last edited an hour ago
The issue is that For Each runs sequentially, so the flow waits for each approval in its iteration order. If approvals happen out of order, task creation is delayed.
Create all approvals first, then use a Flow or Business Rule on sysapproval_approver to create the task when each approval is approved. This allows tasks to be created regardless of the approval order.
This helps other users find accurate and useful information more easily
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
56m ago
you want sequential approval or parallel approval?
You can use scripted flow approval
Scripted Approvals in Flow Designer with Flow Variables
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
18m ago
Hi @Ankur Bawiskar I want parallel approval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
14m ago
then use script and send approval to all users at once
Scripted Approvals in Flow Designer with Flow Variables
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader