I created a site workflow that iterates through a sql query result set and updates a list item if the sql value had been changed. I log each item that is updated and at the end, I write to the history list the number of items that updated.
The workflow fails almost every morning, but only after it writes to the history log how many workflows had failed. Here is a screenshot of what it says is attached, but the text of the error is:
7/21/2017 7:03 AM Comment Workflow Complete: Updated 71 Sales Orders
7/21/2017 7:05 AM Error System Account An error has occurred in Update M2M Status In SalesOrder List.
Any clue why the workflow would throw an error after a successful completion? The last action in my workflow is Log To History the Comment.
I guess it fails after last action since batched actions are committed just with end of workflow.
are all of your updates applied succesfully/correctly to the list?
to update 300k items sounds to me quite high volume, do you perform commits within loop?
if you could post screenshot of your workflow it could give a clearer picture what's going on there.
I've attached a screenshot of the workflow designer. The collection action just counts how many items were retrieved with the List Query - Get all sales orders with the status is NOT Pending and NOT Closed.
I just log how many list items we are going to process. Typically, it is less than 1000 items. On the last run, it was 798.
Then, for each list item, I query another list that has a status. If the status does not match what is in the list item, I add 1 to a counter that keeps track of how many are actually updated, and then I update the list item.
Once all list items are finished, I log to history that the workflow is complete and how many items were updated.
Then the workflow ends, but throws an error.
to update 800 items in one batch still might be too much.
I'd try to add commit pending changes action into for each loop, right after update action and let it commit always after X updated items.
there is no clear value of X, since it might depend on different factors, but you may start with eg. 100 and if workflow still fails then decrease it, if it work you may try to increase it a bit and iterate to some suitable value for your environment.