Workflow Modification Forms (Office SharePoint Server 2007)
You may want to enable users to alter your workflow at specific points while it runs on an item. The options you present to users in this way are called modifications. You can then create modification forms that enable users to specify the parameters of the modification.
You can also create Microsoft Office InfoPath 2007 workflow modification forms. However, by default, such modification forms work only as server-side forms. They are not displayed in the 2007 Microsoft Office system client applications, even if they were designed as symmetrical forms in Office InfoPath 2007.
For more conceptual information about workflow modification forms, see Workflow Modification Forms (Windows SharePoint Services) in the Windows SharePoint Services 3.0 SDK.
Specifying Modification Forms
Each Office InfoPath 2007 modification form you use in your workflow must have its own GUID. Office SharePoint Server 2007 uses this GUID to match the modification selected by the user with the appropriate form.
Specifying a modification form requires setting the following data:
In the workflow template definition, set the ModificationURL attribute of the Workflow element to the following value:
This is an .aspx page included with Office SharePoint Server 2007; the page includes an Office InfoPath Forms Services Web Part to host the Microsoft Office InfoPath 2007 workflow modification form.
Add two elements to the Metadata element in the workflow template definition XML. The first element is Modification_GUID_FormURN Element (Workflow), where guid is the GUID you generated for your modification form; set this element to the URN of the modification form. For example:
<Modification_GUID_FormURN> urn:schemas-microsoft-com:office:infopath:workflow:ReviewRouting-Modify </Modification_GUID_FormURN>
The second element is Modification_Guid_Name, where guid is the GUID you generated for your modification form; set this element to the name you want to give your modification. Office SharePoint Server 2007 displays this name as the link text for the modification link on the workflow status page. For example:
For more information about the workflow definition schema, see Workflow Definition Schema in the Windows SharePoint Services 3.0 SDK.
Modification Form Processing
When the user clicks a workflow modification link, Office SharePoint Server 2007 examines the ModificationURL attribute of the Workflow element to determine the form to load. For Office InfoPath 2007 forms, the developer has set this value to
"_layouts/WFMod.aspx". Office SharePoint Server 2007 loads this page. The page examines the appropriate Modification_GUID_FormURN Element (Workflow) element, based on the modification GUID passed to it by Office SharePoint Server 2007. The page loads the specified InfoPath workflow modification form. The page also passes the form the context data from the ContextData property of the EnableWorkflowModification activity as the primary data source of the form.
The ContextData property of the EnableWorkflowModification activity must contain XML that conforms to the modification form XML schema. This is true even if you are not passing any context data to the form. In such cases, you must still specify XML that conforms to the modification form XML schema, even though the XML contains no data. If you do not, the WFMod.aspx page cannot pass the expected XML string to the modification form on load, and the modification form fails to load.
When the user submits the modification form, the WFMod.aspx page calls the ModifyWorkflow method, passing the workflow instance ID and the updated context information.
Office SharePoint Server raises an OnWorkflowModified event when the ModifyWorkflow method is called. To handle the event and process the modification, add an OnWorkflowModified event activity to the workflow. The ContextData property of this event contains the XML submitted by the modification form.