Alternative to "For Each" Activity in Flow Designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2025 11:06 PM
Hi Experts,I 've been struggling with this issue for the past two weeks and haven't found a proper solution yet.
Is there an alternative to the "For Each" activity in Flow Designer?
I have a Lookup Records action that retrieves multiple records, and I need to apply a Custom Action to each record individually. Currently, using For Each, but looking for a different approach to achieve the same functionality without using For Each.
Is there any alternative way to apply the custom action to each record?
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 10:29 PM
@mrreddy534 , yes, that's correct. I believe you'll need to use the loop logic itself, as I don't see any other way to avoid looping.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 02:03 AM - edited 02-25-2025 02:05 AM
@GopikaP , I am using a Custom Action to trigger a workflow, and I have added it inside a For Each loop, the workflow is triggering correctly for all the RITM's. If this for each approach is necessary to trigger a workflow for multiple records, then I am facing a problem.
within that calling workflow, a Catalog Task is being created. In the Task Activity script, I am updating the 'Command' catalog variable for each RITM triggered by this workflow.
1st RITM 'Command' variable = Row Data 1 (also available on the RITM form as a catalog variable, we need to update command variable based on "row data 1" variable value)
2nd RITM 'Command' variable = Row Data 2
And so on, up to 5 RITMs.
However, when I do this, all 'Command' variables are being updated with the last row's data, instead of their respective row data.
If you have any ideas on how to resolve this, please share your suggestions. I would really appreciate your guidance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 03:40 AM
Hi @mrreddy534 , if possible, could you share some screenshots of the flow for better understanding?
Also, this MRVS belongs to the main RITM, right?
After the main RITM is created, additional RITMs (is this the same catalog item as the main RITM's?) will be generated under the same request based on the row count of MRVS (one RITM for each row)
Then, in the loop workflow, a catalog task is created for each RITM, and the 'command' field needs to be updated with the corresponding RITM mrvs row value. But something is going wrong there and updating wrong values. Right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 04:42 AM
Hi @GopikaP ,Thanks for looking into this. Let me clarify your question
1. Yes, the Multi-Row Variable Set (MRVS) belongs to the main RITM.
2. Yes, the newly created RITMs are under the same catalog item. The number of new RITMs created depends on the number of rows in the MRVS. I am using a For Each loop to iterate through the MRVS rows and create new RITMs accordingly.
3. Regarding how the calculation works for RITMs and MRVS rows:
For example, if there are 3 MRVS rows, I am creating 2 additional RITMs.
So, in total, there will be 1 main RITM + 2 additional RITMs = 3 RITMs, which matches the 3 MRVS rows.
4. For each RITM, I am assigning values from the corresponding MRVS row:
The values from each MRVS row are stored in catalog variables (row_data_1, row_data_2, etc.).
The command catalog variable (available on both the RITM and Catalog Task) needs to be filled based on these values.
Example:
1st RITM → command = row_data_1
2nd RITM → command = row_data_2
And so on, up to 5 RITMs.
5. Issue: When updating the command variable, instead of filling it with the respective MRVS row data, all RITMs are getting updated with the last row's data.
To help understand the setup better, I am attaching three screenshots:
Screenshot 1: The overall Flow structure.
Screenshot 2: The Custom Action script that triggers the workflow.
Screenshot 3: row data catalog variables on the RITM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 08:22 AM
Hi @mrreddy534 , based on my best understanding, I have attempted to recreate something similar to your requirement. - Please see the screenshots -
One main RITM that user submitted with 2 rows in MRVS-
One more RITM is created under the same REQ -
Variables in RITM #2
For both RITM#1 and RITM#2 - catalog task is created with each row's value which is stored in 'command' field
Is this what you were expecting, or is there any misunderstanding? I have skipped some steps to focus on the main point. If this aligns with your expectations, I will share the flow.