cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Is there any fast way of looping

Jump to solution

I have a workflow which have a loop action and the loop runs from 0-15 times depending on the conditions. But loop action takes a lot of time for each repetition. Is there any way by which I can speed up this pause between loops or any other way by which I could attain my goal?

Thanks

Ratnesh

Labels: (2)
0 Kudos
Reply
8 Replies
barryandersonuk
Nintex Newbie

Re: Is there any fast way of looping

Jump to solution

Hi Ratnesh,

You can disable safe looping to speed things up but this comes with a risk:  Nintex Workflow - Safe Looping - Vadim Tabakman

Thanks,

Barry.

0 Kudos
Reply
Automation Master
Automation Master

Re: Is there any fast way of looping

Jump to solution

Hi Ratnesh,

as Barry said, you could disable safe looping but remember that the changes to Safe Looping setting in Central Administration are reflected only to the workflows published after the change, so if you prefer to disable safe looping only for one or few workflows, you could disable it, publish them, and then re-enable safe looping..

You have just to remember that each time you publish a workflow, the current setting is applied to it

Giacomo

Reply
jblair
Nintex Newbie

Re: Is there any fast way of looping

Jump to solution

One "trick" is this: Go to Central Admin, and disable safe looping (in global settings). Open your workflow in designer, and publish the workflow when safe looping is off. Go back to Safe Looping in central admin, and re-activate it. This will create an exception for the workflow you published, but leave Safe Looping on for the rest of the farm. If you modify your workflow, you will need to follow the same process each time you publish.

However, if that workflow is resource intensive, it could have performance implications for the farm so I would recommend you test it thoroughly prior to going live with it.

0 Kudos
Reply
mzi
Nintex Newbie

Re: Is there any fast way of looping

Jump to solution

Hi Ratnesh,

there is another, semi-fast way where you can keep safe looping enabled and still have a relatively fast loop. This way uses the for each action, which does not have the same safe looping as the loop action.

  • create a loop action
  • create a collection variable
  • add a regex action to the loop, where you split a string like this: 1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20 into a collection
    • this way you have 20 entries in the collection
  • next, add a for each to the loop (after the regex)
    • the for each iterates the collection variable
    • the for each also has the Stop processing option in its settings
    • here add a bool variable
  • inside the for each, you can set the bool variable using the same condition you would use for the loop action

loop for each.png

This way, for each (safe) loop, you can have 20 fast iterations. If you are absolutely sure you wont need more than 20 iterations, you can even forego the for each.

I hope this was readable, if you have any question, please dont hesitate to ask

0 Kudos
Reply
Nintex Employee
Nintex Employee

Re: Is there any fast way of looping

Jump to solution

Hey Martin,

I've done similar things to this in the past.  Great response here!!!

Just out of curiosity, what do you use the Loop action in this case for?

Why not just have to the RegEx and then a For Each.

regards

Vadim

0 Kudos
Reply
mzi
Nintex Newbie

Re: Is there any fast way of looping

Jump to solution

Hi Vadim,

the Loop action is in case you need more than 20 iterations to reach the desired result. The loop can be removed in case it is absolutely certain there are no more than the predefined number of iterations. By keeping the loop areound the for each, the workflow still can run as long as needed in case more iterations are required.

Best regards,

Martin

0 Kudos
Reply
Not applicable

Re: Is there any fast way of looping

Jump to solution

Thanks all for your ideas. I tried implementing for each action instead of loop and it works just like I wanted to. :-)

Reply
Automation Master
Automation Master

Re: Is there any fast way of looping

Jump to solution

We do something similar, but your way may be more efficient.

Our collection goes into a For Each with however many items in it, and each time thethe loop runs it adds one to our variable, when the variable hit 10 or so (depending on the workload in the loop) we have a Run If at the end of the loop that runs when our variable hits 10 and then "Pause For" 1 minute. This can actually take up to 5 mins depending on when the timer job runs next, and then it resets the variable back to 0 and continues for the next cycle.

We found that if the For Each loop is running on a large collection it tends to fall over itself. For example, we may have a site workflow that runs on a list to kick off another list workflow on all the items in a list that match certain criteria, this could be hundreds or thousands. It would start off ok, but would soon fall over itself and Stop although it would tell us it completed.

Putting this Pause in the loop enables us to set this process going overnight without worrying about monitoring it.

Whether it's good practice or not, I don't know but it's the best way we found of running workflows on a large number of items.

Reply