String concatenation in flow designer

arjun0101
Tera Contributor

Hi team,

 

i am using flow designer. I have created a flow variable x.

 

In flow i have for each loop, after every iteration i want concatenate variable x with new value.

Like in pseudo script: 

var x='';

 

for(var i in array)

{

   x += array[i];

}

print(x);

 

how this can be achievable in flow designer?

4 REPLIES 4

Runjay Patel
Giga Sage

Hi @arjun0101 ,

 You can use below script in flow script.

RunjayPatel_0-1732204891973.png

 

var array = ["Runjay", "Patel"];
var x = '';
for (var i in array)
    x += array[i];

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

In this video i have explained about Web service integration in ServiceNow like how it works, how we can configure it, what are the prerequisite and many more. I have covered below topics in this video. 1. understand Web Service. Like when and how we will use it. 2. Talked about Inbound and ...

thank for your reply,

how to declare variable in flow and use it for append new values?

arjun0101_1-1732206252483.png

 

AshishKM
Kilo Patron
Kilo Patron

Hi @arjun0101 ,

Do you face any issue with concatination code in flow, you already shared the code.

please share the flow screen shot where you are trying to add this logic.

 

-Thanks,

AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Hi Ashish,

 

arjun0101_0-1732205881628.png

here in for each loop , after action execution i want append var x with action output.