I was working on developing a Custom State Machine Workflow in MOSS and had following scenario in a particular state of the workflow:
Create a Task –> Wait for Task to Be Created –> Send Email Alerts –> Wait for the User to Take Action on the Task.
To create a state activity with above scenario, I created a state activity that looked like:
StateInitialization Activity contains CreateTask Activity
EventDriven activity contained following:
Well the problem is “Only the first child activity of ‘EventDrivenActivity’ can implement the ‘System.Workflow.Activities.IEventActivity’ interface”
The solution is you can have State Activity within a state activity:
First Child Activity’s StateInitialization contains CreateTaskActivity and EventDriven activity of the First Child contains OnTaskCreated Activity and SetState Activity to Set the state to Second Child (Child2)
Second Child’s EventDriven looks like:
Now you can have two Event Driven Activities in a single state!
Finally make sure the Correlation token’s Owner Acitity is the parentState Activity and not the Child State activity
Download the Sample Code here.