How to set flow variables values using script

nayanmule
Kilo Sage

Hi All,

 

I am getting two ids values from an action (two separate responses using for each loop )in flow designer.

nayanmule_0-1748346086007.png

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

nayanmule_1-1748346116334.png

 

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 

3 REPLIES 3

Ankur Bawiskar
Tera Patron

@nayanmule 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@nayanmule 

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! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Utpal Dutta
Tera Guru

Hi @nayanmule ,

I think what you need is an array which will hold comma separated values. For that you can follow below steps:

  1. Create a flow variable of type string.
  2. In your flow set flow variable in first or second step as [].
  3. When you're in for loop, push items into array using push function.

Screenshots:

Set variable as empty array: 

UtpalDutta_0-1767858629299.png

In for loop, parse your flow variable and push items into array:

UtpalDutta_1-1767858716100.png

 

You will then have output like this :

UtpalDutta_2-1767858842600.png

 

I hope my answer helps, if it does then please mark it Helpful & Accept this solution

 

Thanks,

Utpal