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 to No.

For each loop is set to retrieve all the items from the smartobject with the query like, Select ID column from SharePoint list where flag=no.

Then, doing some operation on list item fetched with ID and then updating the flag to Yes, indicating done with that item in a list.

Issue
Updating the flag to yes, loop only retrieves alternate or odd items in a list (basically, it processes only half of times in the list).
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