I've created a state machine workflow with Visual Studio 2010. In this state I have one state for updating information.
- I've added state initialization. In this initialization I've added a CreateTask activity. The task token's owner is the same state. I've bound TaskProperties and TaskId to fields and I've set their values on OnInitializing method. (pretty standard).
- Next I've added another Event Driven activity to this state and I've added OnTaskCreated event. In this event I've added an activity to send an email. (this is done because other states should be assigning their tasks, but not all should be sending email notificaitons).
- I've also added an Event Driven activity with OnTaskChanged to handle if the task was completed. After the task was completed I've added SetState activity to transition into another state.
The strange behavior I'm having is that OnTaskCreated event is not fired, when the task is assigned (I can see the task in SharePoint but even after 15 min the breakpoint doesn't get hit and the email is not sent.
But when I edit and complete the task, instead of OnTaskChanged the OnTaskCreated is fired.
Does anybody have similar issues and does anyone know how to fix this strange behavior?