Counter using IF node


I have a requirement where the loop has to run only twice and even if the second time it fails the set up has to come out of loop and take another path.

I tired using IF node with {{ $runIndex === 4 }} but its not working.

The idea here is, i have a work flow which does a calling using twilio and when the first time the call is not been answered, the workflow has to retire the call again after a wait time of 30 secs.Even in the second attempt the call is not answered, the set up has to come out of that loop and try a different number.

Hey @Sathya_Narayanan,

Give this a bash, What we do is set a counter then enter a loop to perform the action. The first If would need to check if the previous task worked if it did off it pops to the rest of the flow if it failed it hits a second if to check the counter.

If the counter is 2 or more it takes the “second path” if not it goes to a set node that increments the counter by 1 then goes back to the action.

1 Like