Business process looping a task

Hello everyone,

I am trying to script a complex business process and trying to loop a BOT task. in below example, I have number = 0; and each time bot is triggered in loop, number is increment by one.

However, everything seems good, my bot is trigger only one time. Is this a limitation of control tower or I am not doing right way.

Please advice.


how are you holding the number variable in testloop task??

I increment value in Bot task and created rule which checks for routing if value reached the limit (i.e.5) and take flow accordingly.

can you share the code of your testLoop where you are persist, fetch and increment the counter?

btw, if its a counter based logic, why not use"<loop> " inside the task? my concern is that when your BP executes the variables are re-defined, so your counter is lost. Unless you have a logic to persist the counter outside task and fetch it from there

This one is simple use case, below is I am planning to implement.

my first bot task download and save attachment from outlook email, then in second bot task read data from spreadsheet to validate in each role and a single row is passed to next bot task to make entry in web our system. Loop in business process goes on between bot task 2 and 3 until all row of excel is processed. (1.6 KB)

So in this case, in bot task will help me for sure, but code of bot will be become much more complex when we have large number of items in excel row to process. For that reason I am planning to keep my bot task simple.

But if looping itself is not working then it would be difficult. For that reason I seeking help on this.

Vikas Yadav

Finally fixed it myself

The mistake I was making is testing on a single bot which looks not right, rather to use loop . But when I created three bots, each bot incrementing the value of index and lastly decision to exit by index value.

Vikas Yadav

1 Like

Hey vikas

I’m doing a similar recording, can you show me a prt screen of your actions flow if you don’t mind?


Hi Gonçalo,

Could you please tell me what functionality you are looking for, I can send you screen shot accordingly.

Vikas Yadav

I’m trying to build a workflow with 3 processes followed by a business rule that goes back to the first process if a condition is met. That’s the part i’m having issues understanding, using the loop and if/else action to make that happen.

To share variables across bots in business process, you need to define the variables in all three bots with same name and types. I would suggest to use either number type or Boolean types to make your rule(decision). The string variables gets added with escape characters each time control moves from one bot task to another bot task. To avoid this, you may use numbers or Boolean types or you need some string cleanup scripts for these variables.

Hope this helps


It seems Workfusion does not allow task to loop. The connection from a task to a decision is done only one whatever you do. Anyone got an alternative?