Workflow Modification Forms in SharePoint Server 2010 (ECM)
Last modified: April 07, 2010
Applies to: SharePoint Server 2010
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 InfoPath 2010 workflow modification forms. However, by default, such modification forms work only as server-side forms. They are not displayed in the Microsoft Office 2010 client applications, even if they were designed as symmetrical forms in InfoPath 2010.
For more conceptual information about workflow modification forms, see Workflow Modification Forms (SharePoint Foundation) in the Microsoft Windows SharePoint Services 3.0 SDK.
Each InfoPath 2010 modification form you use in your workflow must have its own GUID. SharePoint Server 2010 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 SharePoint Server 2010; the page includes an Office InfoPath Forms Services Web Part to host the InfoPath 2010 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) - ECM, 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. SharePoint Server 2010 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 Definitions in the Microsoft SharePoint 2010 Software Development Kit (SDK).
When the user clicks a workflow modification link, SharePoint Server 2010 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". SharePoint Server 2010 loads this page. The page examines the appropriate Modification_GUID_FormURN Element (Workflow) - ECM element, based on the modification GUID passed to it by SharePoint Server 2010. 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.
SharePoint Server 2010 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.