Workflow Instance "StateGuid"
Overview
Every WorkflowInstance
contains a property called StateGuid
.
This property is automatically set to a new GUID every time the Workflow Instance moves to a different Workflow Step.
This provides a sort of “version stamp” for that WorkflowInstance
.
For instance, consider a Workflow Instance
that goes through these changes:
State | Workflow Step |
|
---|---|---|
Initial state | Step 1 | ABC… |
Moved forward in the Workflow | Step 2 | DEF… |
Moved backward in the Workflow | Step 1 | GHI… |
The CurrentStep
property is insufficient to use as a “version stamp” because it has the same value for both the initial and final state.
The StateGuid
value, however, is changed every time the Current Step changes, and is never reused.
Thus, the StateGuid
can be used to tell if a WorkflowInstance
has moved Workflow Steps, even if it returns to a previously-visited Step.