How to: Design a Workflow Form to Use Association and Initiation Data in SharePoint Server 2010 (ECM)

Last modified: May 07, 2010

Applies to: SharePoint Server 2010

When Microsoft SharePoint Server 2010 displays a custom Microsoft InfoPath 2010 form for workflow association or initiation, it also passes the form any association or initiation data as XML. For a form control to display an element of this XML, the form control must be data-bound to that XML element. SharePoint Server 2010 automatically performs this data-binding for workflow association and initiation forms, as described in this topic.

When SharePoint Server 2010 displays a custom InfoPath form for workflow association, it calls the Forms Server control to convert the form into a Microsoft ASP.NET 2.0 page and host it. As part of the form load, the Forms Server control passes any predefined association XML data to the form as XML. The Forms Server control automatically data-binds any elements to the form control of the same name. For example, the Forms Server control would automatically data-bind a form control named Comments to the data element Comments. You do not have to explicitly define the association data schema as a secondary data source.

To use association data, name your form control the same as the element in the association data XML.

You can specify default association data in the AssociationData element of the workflow definition file for your workflow solution. For more information, see Workflow Definitions in the Microsoft SharePoint 2010 Software Development Kit (SDK).

In the same way, the Forms Servers control passes the association form data back to SharePoint Foundation. The workflow association data is stored as XML in the AssociationData property of the appropriate SPWorkflowAssociation object. When a workflow instance starts, this data is also passed into the workflow via the AssociationData property of the SPWorkflowActivationProperties object.

For more information about how association forms are specified and processed, see Workflow Association and Initialization Forms in SharePoint Server 2010 (ECM).

To data-bind form controls to association data

  • Name your InfoPath form control the same as the element in the association data XML.

When SharePoint Server 2010 displays a custom InfoPath form for workflow initiation on the server, it calls the Forms Server control to convert the form into an ASP.NET 2.0 page and host it. As part of the form load, the Forms Server control retrieves the initiation data from the AssociationData property of the appropriate SPWorkflowAssociation object, and passes it to the initiation form as XML. The Forms Server control automatically data-binds any elements to the form control of the same name. For example, the Forms Server control would automatically data-bind a form control named Comments to the data element Comments. You do not have to explicitly define the initiation data schema as a secondary data source.

Note Note

The Forms Server control is invoked only if you initiate the workflow from the Office SharePoint Server 2007 Web browser interface. If you initiate the workflow from a client application, it can host the InfoPath workflow initiation form without converting the form to ASP.NET. However, in each case the data-binding operation is handled in the same way.

To use initiation data, name your form control the same as the element in the initiation data XML.

In the same way, the Forms Server control handles starting the workflow itself, and passing the initiation form data to the new workflow instance. After the workflow starts, the initiation data is stored in the InitiationData property of the SPWorkflowActivationProperties object returned by the WorkflowProperties property of the OnWorkflowActivated activity.

For more information about how initiation forms are specified and processed, see Workflow Association and Initialization Forms in SharePoint Server 2010 (ECM).

To data-bind form controls to initiation data

  • Name your InfoPath form control the same as the element in the initiation data XML.

Show: