Infinite loop even when end was reached

  • 7 April 2020
  • 7 replies


I created a loop that use a reference to loop through and send an approval task to end users. Once the loop is completed, it sends a final email that all has approved. For testing purposes, I assigned all these tasks to myself. 


The problem is that even though the loop has gone through all the records (and I did receive the final email), for some reason the loop start all over again. When I look at the workflow history, i see that it did reached the end, but then loop is still active. It just keep on looping. At loop no 4 is terminate the workflow. This is quite frustrating. It seems that K2 does not exit the loop!


Version: K2 five (5.3) with FP 43

7 replies

Userlevel 2
Badge +5

Hi bennier,


Can you attach a screenshot of the design of your workflow on the loop ?

So we can have a better view on why this issue occurs


Can you try to run the below query and see if the instance from that workflow appears as the result

SELECT * FROM [Server].[ProcInst] where Status = 1


Should you feel that this post is of use and or an accurate solution to the raised question, I kindly encourage you to mark it as such
using the 'Mark as Solution', 'Kudo' andor ‘Me Too’ options.




K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member.

The reference is called "Additional Approvers"

I circumvented the problem by adding a loop index and then explictly test the loop index value (if 0 then redirect it to the end). I tested this and I get the expected results - though this is not an elegant solution. See the screenshot.


I ran the query but received no results.
Hi @bennier,
In your loop, all the routes are not going back to the next item. What happened if on the approver rejected?
I guessed that in your test you approved all the instances?

If you look in the reports section, you will see all the activity history. You can use the folio to debug and see how the WF behave.


Hi JJ,
The reject branch goes to an End action. And yes, I only tested approvals. 


I also looked in the Report of the workflow history. In the XML code I could see the reference having only 2 items, but I end up approving over 6 items. For some reason the loop does not quit even when the End has been reached. In the Data Audit section I also monitored the loop index variable: for the first run of the loop the index start with 1, but any consecutive loops start with the index 0 (and not 1).


I also tested the following: In the End action, you can select to end normally (default), or terminate the workflow immediately. When I select the latter, the update of the last SmartObject does not happen. So that is not a solution to my problem.

I see, So, what are you returning in your reference? How many items? Do they have a unique identifier?
If you did this in denallix VM, could you please share the package. Will try to reproduce.