It is easy to find WSS ASP.NET samples for Instantiation and Task Edit forms, but it is hard to find sample for Modification form. Maybe many people think there is no much difference, but is that true?
Modification form is quite useful in WSS work flow. For example, after a long running task has been assigned to an analyst, the analyst takes vacation for weeks. At this point, the Modification form can be used to reassign the task to another person.
You can define Modification form in Feature file with the similar way for Instantiation form. But how about the workflow part?
Instantiation form happens at the very beginning of a workflow, but Modification can happen anywhere in a scope.
A common way to define Modification in workflow is to put EnableWorkflowModification activity inside an EventHandlingScope activity. Other activities inside the same scope do the normal work. When Modification form is accessed, an event will raised to the workflow, so that the EventHandlingScope activity can handle the event and call event handler.
In Visual Studio, right-click the EventHandlingScope activity and select "view event handlers":
Then you can add OnWorkflowModified and UpdateTask activities to the EventHandlersActivity:
The Modification activities have their own ContextData and CorrelationToken, because they are actually outside the normal workflow.
One issue I saw: If there is an OnTaskChanged activity already defined in the EventHandlingScope (like below), you had better not add another OnTaskChanged activity inside the EventHandlersActivity; otherwise, you would be surprised to see only one OnTaskChanged activity is called.