Sharepoint Visual Studio State Machine Workflows: OnWorkflowItemChanged and Infinite Loops
// November 6th, 2009 // Sharepoint
Im not sure if it was just me, but everytime i started creating a workflow i would get to the point where id have an infinite loop. This was created in ONE state by:
1. Executing workflowProperties.Item.Update(); on a particular item
2. Creating a onWorkflowItemChanged method which fired obviously whenever an item was updated.
Just a little clear thinking, and perhaps a few more coffees that there is actually a solution. See the onWorkflowItemChanged was executing in the same state (so perhaps the Update() happened in StateInitialized AND onWorkflowItemChanged in the EventDriven). There is an easy solution for this
1. Update your onWorkflowItemChanged to fire in a separate state (call it statepending)
2. Execute your Update() of the item in StateFinalized and then execute a SetState to statepending
I never did find much on InfiniteLoop so i must have been the only one with this problem!








