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

Endless looping when using a state machine in the loop

Jump to solution

I would like to make a function about 'Add an Approver', so I add a 'State machine' inside a 'For each' loop, but the loop will not end. No matter how many times I choose approve, it will go back to the start of loop. If  I remove the 'State machine', it is OK. 

Please someone help me.

Labels: (2)
Tags (2)
0 Kudos
Reply
3 Replies
Nintex Employee
Nintex Employee

Re: Endless looping when using a state machine in the loop

Jump to solution

It's always a best practice to have each logical branch in a state machine to end with a Change State action.  In order for the State Machine to end properly, it needs to go through a Change State action with a value of "End State Machine" value at some point.  Also it's best practice to use a Change State action with a value of "End State Machine" value instead of an "End Workflow" action in the State Machine.

Your Approve branch in the "Assign Flexi Task" action does not have a Change State action.  Try that and see what happens.

View solution in original post

Reply
Automation Master
Automation Master

Re: Endless looping when using a state machine in the loop

Jump to solution

So there are two things to  consider:

1) The state machine is itself a looping mechanism.  Without an End State action the  state machine will continue to loop.

2) Assign Flexi task will pause until the task is complete.   You may perceive this as Endless looping, but really the workflow is just  waiting until the  first Assign Flexi task is  completed, before doing your next "For Each" iteration.     Did you mean for the For Each to assign out a bunch of tasks consecutively without waiting on the  previous approval to occur?  If so you will need to tweak the  design.

Thanks

Mike

Reply
Not applicable

Re: Endless looping when using a state machine in the loop

Jump to solution

Thanks to Eric and Mike. I add the 'End State Machine' action and now the loop is OK.

Reply