"For Each" OOB Function Failing in Subflow for MRVS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2025 04:32 AM
I am working on a subflow where I need to loop through each value in a Multi Row Variable Set (MRVS) using the out-of-the-box For Each function. This works fine in the main flow for the same catalog item and MRVS, but in the subflow I get this error:
{ "Create Policy": [ { "action": "allow", "application_inspection": "icmp", "destination_group": null, "destination_ip": "2.2.2.2", "destination_security_zone": "any", "group_rules_by_tag": "Mainframe", "rule_name": "Ak_test1", "service_service_group": null, "source_group": null, "source_ip": "1.1.1.1", "source_security_zone": "any", "update_policy": false }, { "action": "deny", "application_inspection": null, "destination_group": "ansible_test1", "destination_ip": null, "destination_security_zone": "any", "group_rules_by_tag": "Mainframe", "rule_name": "Ak_test2", "service_service_group": "tecp-123", "source_group": "ansible_test1", "source_ip": null, "source_security_zone": "any", "update_policy": false }, { "action": "allow", "application_inspection": "icmp", "destination_group": "ansible_test1", "destination_ip": "5.5.5.5, 6.6.6.6", "destination_security_zone": "any", "group_rules_by_tag": null, "rule_name": "Ak_test3", "service_service_group": "tcp-123", "source_group": "ansible_test1", "source_ip": "3.3.3.3, 4.4.4.4", "source_security_zone": "any", "update_policy": false } ] }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2025 04:34 AM
how are you accessing it in subflow?
are you passing input to subflow and then iterating?
if yes then you should pass array of objects
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2025 04:39 AM
Hello,
Thank you for a quick response!
I am using Get variable action and fetching the details, and passing the MRVS directly from there. It's data type is Array.Object. That part I have already checked.
The same MRVS is working fine in the flow, it's just that the steps under both the for each loops are different. But that should not impact the iteration as I am not changing the variable value anywhere.
The first iteration is working fine but I am getting this error when it is going for the second iteration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2025 04:45 AM
I was able to pass and then iterate in subflow
1) subflow accepts input of type Array of Objects
2) then it uses For Each
See this output, also attached this as an attachment
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2025 05:05 AM
When I am also taking a copy of flow and just using log step under for each it is working fine. I even added a timer of 5 mins to delay the process, then also it worked fine. But it is failing when rest of the steps are coming in picture. I am making an API call under this calling few custom actions and updating worknotes of the catalog task. I am not sure what is causing it to fail. It is a very strange issue.