How to push data into array variable in flow designer after for each loop?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 02:45 AM
How to push data into array variable in flow designer after for each loop?
I know to script this in action, but it should not be part of action. How to do it as below in flow directly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 02:56 AM
did you try to explore on flow variable which you can try to append?
it doesn't support array as type so I believe the only way is to use custom action with script
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-21-2024 09:49 AM
Hi I recently tried doing the same pushing values from a repeater to a Flow Variable to build a list of sysIds
I did something like this and it worked beautifully check it out
const list = fd_data.flow_var.ranklist? fd_data.flow_var.ranklist:[];
list.push(fd_data.flow_var.competitor);
return list
instead of initiating the variable with an empty array in another action we check with a "?" if there is a value then if True use the value else set it as an empty array with "[ ]" then we can push the new value to the array and return the list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2025 05:03 PM
This is basic programming 101 and Flow designer can't even do this, AND we're being forced as developers to use Flow designer? And why has this not been answered by any of the ServiceNow employees on this board?
And WHY can we still today not able to create an ARRAY when declaring a flow variable?