Skip to content

Commit ca80438

Browse files
mkholtClaude <noreply@anthropic.com> via Conducktor
andcommitted
Set SuppressWrites flag unconditionally per execution
Reset() does not clear the Variables dictionary, so setting SuppressWritesKey only when suppressWrites was true could leave a stale 'true' on a reused WorkflowTree instance, silently suppressing a later real workflow's Update. Assign the flag on every Execute so behavior depends only on the current call. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>
1 parent d581bb7 commit ca80438

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/XrmMockup365/Workflow/WorkflowTree.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ public WorkflowTree Execute(Entity primaryEntity, TimeSpan timeOffset,
118118
throw new WorkflowException("The primary entity must have an id");
119119
}
120120
Reset();
121-
// Set after Reset(), which reinitializes Variables and would otherwise drop this flag.
122-
if (suppressWrites)
123-
{
124-
Variables[SuppressWritesKey] = true;
125-
}
121+
// Set unconditionally after Reset() (which doesn't touch this key): a WorkflowTree instance
122+
// can be reused across executions, so the flag must reflect only the current call - never a
123+
// value left over from a previous suppressWrites: true run, which would otherwise silently
124+
// suppress a real workflow's Update.
125+
Variables[SuppressWritesKey] = suppressWrites;
126126
Variables["InputEntities(\"primaryEntity\")"] = primaryEntity;
127127
Variables["ExecutionTime"] = DateTime.Now.Add(timeOffset);
128128
var transactioncurrencyid = "transactioncurrencyid";

0 commit comments

Comments
 (0)