ForEach workflows experience a one-iteration lag when evaluating variables in the post-conditions of loop-body tasks. This occurs when variables are updated using the :PUBLISH script command.
Symptoms
In the Automation Engine's runtime, ForEach loop-body positions (EJPP rows) are reused/recycled across every iteration. Only the task pointer (EJPP_TaskIdnr) is updated. Because post-condition checks (CHK_POSC) are processed as asynchronous messages, a timing race can occur: if the engine advances to the next iteration before the previous iteration's check finishes, the check resolves against the updated (next) task context, resulting in stale data.
Use :PSET instead of :PUBLISH to update parent workflow variables within a ForEach loop.
:PUBLISH &VARIABLE#, , WORKFLOW with :PSET &VARIABLE# = &VALUE#.:PUBLISH, the :PSET command updates the parent ForEach container's stable EH/EV record immediately, ensuring it is not affected by the per-iteration recycling of the loop-body position.For defects and enhancements, subscribe to this article (Reference: ) to receive updates on the formal fix status.
Standard (non-loop) workflows are not affected by this behavior because they do not recycle position records.