How to set flow variables values using script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 04:43 AM
Hi All,
I am getting two ids values from an action (two separate responses using for each loop )in flow designer.
this is the output of the action . I can get more than 1 results here . ..I want to store the accessequestid and use it in the next for each item loop
I want to store them in flow variables with comma separated so that I can use it again in the next for each loop .
Any help will be appreciated.
Thanks,
Nayan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 04:51 AM
create a flow variable and you can append the values you get in each iteration
check this, response from Danmax
How to push data into array variable in flow designer after for each loop?
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
2 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @nayanmule ,
I think what you need is an array which will hold comma separated values. For that you can follow below steps:
- Create a flow variable of type string.
- In your flow set flow variable in first or second step as [].
- When you're in for loop, push items into array using push function.
Screenshots:
Set variable as empty array:
In for loop, parse your flow variable and push items into array:
You will then have output like this :
I hope my answer helps, if it does then please mark it Helpful & Accept this solution
Thanks,
Utpal
