ISSUEAfter a for each loop in a workflow, when the workflow enters any delay action the workflow errors. In the ULS logs, there are "Failed to persist workflow" errors.
ERROR CODEFailed to persist workflow.
RESOLUTIONBatch the For Each loop to run through a smaller number of loops prior to having a delay. The general method for batching a for each loop is:
- Add an inter variable "count" with default value 0.
- In the For Each loop add a run if statement with a condition of count equals 24 (this batches for every 25 items)
- In the run if statement place a set variable action configured to set count = 0 and a 5 minute pause.
- After the run if statement, add a math operation action for count plus 1, and store the value back in to count.