I'm using a simple Workflow for demonstration purposes:
Init sets State1. State 1 waits for item changed and set's state 2. State 2 waits for item change and finishes the workflow.
The problem: When running this workflow and changing the item, the Workflow runs right through to the Completed state, it doesn't stop at Step 2 (
I read that the
onWorkflowItemChanged activity needs the Workflow correlation token to work. I have made an adjustment as in to create a new correlation token per state (via
InitializeWorkflow) and use that correlation token in each state. This way the workflow "stops" in each state, but is this the correct way to go about things?
All I want is for the state machine workflow to wait for item changes and upon that (and some code) continue to the next state.
Basically my question is: How to use a onWorkflowItemChanged in a State Machine Workflow?
Tried to use the
HandleExternalEventapproach (see comment below or here: Capturing OnItemChanged) - to no avail, Events are just not being called at all - one should be able to use the
OnWorkflowItemChangedactivity what else is it for?
Just to add: I verified exactly this behavior on a totally different SP2010 system - my approach as shown in the image must be wrong, but (here comes the kicker) it works in SP2007 (multiple states with a