Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Increment integer flow variable in each loop until variable reach 5 not working with below approach

sanju41
Giga Contributor

In the flow designer sub flow, created a flow variable called counter of integer type

1. assigned 1 value to flow variable 

2. add do the following until

3. Incremented flow variable by using ADD transform function ( used this approach https://snhackery.com/2021/09/03/flow-variables-vs-scratchpad-variables-revisited/)

4. until condition to check is flow variable is equal to 5.

 

sanju41_1-1667450019166.png

 

 

1 REPLY 1

Shyamkumar Wana
Tera Contributor

Hello Sanju,

 

I upgraded my PDI to Rome. Not sure whether it is added to Rome. There is an alternate way :). You can use inline script.

Below code can be used in the inline script. This takes the flow variable position and increment by 1.

var data = fd_data.flow_var.position + 1;
return data;
 
You need to click the inline script icon available next to the text box to add script. Refer the below screenshot:
 
ShyamkumarWana_0-1739857979155.png