Thursday, June 30, 2016

For each loop processes half of the items in K2 workflow.


Scenario 
In my scenario, I have SharePoint list hooked up with smartobject. SharePoint list has flag column (Yes/No), default is set to No. All the items are set to No at the beginning. 

For each loop is set to retrieve 1 item at a time. Then it is doing some operations on that item. Then finally, I am setting flag column to Yes, indicating that item has been processed.


Issue
After updating the flag to Yes, next, loop is retrieving only odd number item from a list, and skipping even number items (basically, it is processing only half of times in the list or only alternate items).

Without update operation, it works fine.

Workaround

Decreasing the index of the for-each loop after the for-each event loop processes all the items.


No comments:

Post a Comment