Is it possible to make a loop in the process?

Is it possible to make a loop in the process?

I'm trying to overcome a problem with my process not working anymore after the introduction of 5 miuntes limitation for automatic activity (

My process is specifically intended for creation of big amount of data, which is the reason why it is done as a process (asynchronous) in the first place. Now I strated refactoring it, the idea is: instead of having one automatic activity as it was, to repeat activity in a loop. The problem is that I can't find any way to make a loop!

I have created function that can take and index like a "loop counter" as input, but I don't know how to increase that index. Process doesn't support local variables. If I make automatic activity that returns integer - it can not have anything as input (where I could pass previously increased integer), and I tried without input (hoping that output value will be kept for the next call) but it didn't work. I wanted also to add "reserved" input parameter for the process - only to use it instead of local variable - but automatic activity can't modify input parameters, they are simply not available as a target for assignment!

This should work if I store my "index" in a separate database table, but I don't like the idea of having a table just for this.

I was also thinking about launching tha same process in the end, but this keeps parent process running until all children are completed. My process was initially intended for doing about a million of loop steps, and idea of having a million of started processes frightens me a lot, especially when I imagine how I will check them for errors or terminate one by one in service center. I know that in some cases of error (like "Request timeout" that I saw because my activity ran longer than 5 minutes) you can only find that error via service center and wouldn't even know if you process is running or not untill check there.

Is there any way to make a loop inside of the process? Have a counter increase? Have somebody solved such task somehow?
Hi Igor,

Activities are not meant for it, and that's the reason of 5 min limitation. One way to workaround this is to call a timer inside you activity. Timers also have a timeout limitation, but when you reach this point, you can wake the timer, so it will keep looping until all the work is finished.

Hope it helps,
Hi Andre,

I don't understand how timer will help me make a loop. Inside of automatic activity (if this is what you meant), there is no widget "timer" available. And on the process level, I don't understand how I will benefit from using it - it will make a delay, and what next?
I have found the solution!

I'm using site property - you can change site property from logic and it will actually have value changed. So in my process I'm using special site property as loop counter, and it works!
(at least with small number of loops, I will test with a million, but don't see why it should fail)
Update. I was stuck at another limitation: after 10000 activities, the process is automatically suspended. So I changed it again - now my activity does 1000 of loops inside of itself, which seems to fit into 5 minutes limitation, and so I'm able to make 10 millions of total loops maximum.
Hi Igor,

First of all, be careful when changing site properties dinamically. This invalidates the server cache and can lead to performance problems.

All timers have an built in action to wake it up. So you can call this action in your Automatic Activity and thereafter the work will be with the process. See below, your process would be something like this:

Note: if you are using activities only for that reason, actually you don't need to. Timers are enough to achieve this.

Hope it helps,

I think I understand, Andre, your approach is based on using global Timer to "continue" the process.
But this again requires storing some state in the database, so that the timer will know what stage the process is at and continue from it. This is what I mentioned at the start - I don't want to create another table just for this, all I needed was a counter, and my process is not about processing records, it instead creates the records.

But in the cases when there is some records processing - your solution must be good, and adding an attribute that will show which records were processed is natural in that case.