Share via

Workflow Task Forms in SharePoint Server 2010 (ECM)

Applies to: SharePoint Server 2010

You can specify custom forms for the tasks in your workflow. Because a workflow task is a SharePoint item that is assigned a content type., the content type determines the custom forms to use for the task types in your workflow.

For more conceptual information about workflow task edit forms, see Workflow Task Forms (SharePoint Foundation) in the Microsoft SharePoint 2010 Software Development Kit (SDK).

Specifying Workflow Task Forms

To specify a Microsoft InfoPath 2010 edit form for a workflow task, do the following:

  1. In the workflow definition file, set the TaskListContentTypeId attribute of the Workflow element to the following content type:


    This content type, included in Microsoft SharePoint Server 2010, specifies custom task display and edit forms that include an Office Forms Server control for rendering InfoPath forms.

  2. Add an element to the Metadata element of the workflow template definition. This element is TaskID_FormURN Element (Workflow) - ECM, where N represents the integer you assigned to that task type within the workflow. Set this element to the URN of the InfoPath 2010 form you want to use with this task. For example:


    To differentiate the task types that your workflow creates, you assign each task type an integer identifier within that workflow. The first task type is 0, the second 1, and so on. This enables you to assign different content types, and different forms, to each task type. These task type identifiers must be unique only within a given workflow. For example, any workflow that creates a task has a task 0 task type; however, the task type does not have to be the same across all workflows.

For more information about the Workflow Definition Schema, see Workflow Definitions in the Microsoft SharePoint 2010 Software Development Kit (SDK).

Workflow Task Form Processing

When a user clicks the link to edit or display a workflow task, SharePoint Server 2010 examines the TaskListContentTypeId attribute of the Workflow element to determine the task content type. It next examines the content type definition to determine if a custom form is specified. If you are using an InfoPath edit form for your workflow task, you have set the content type to a type that specifies custom task display and an edit form that includes an Office Forms Server control for rendering the InfoPath form. SharePoint Server 2010 loads this custom form, which in turns examines the appropriate TaskID_FormURN Element (Workflow) - ECM element, based on the task ID SharePoint Server 2010 passes to it. The custom page then loads the specified form for the task type.

This page also retrieves the contents of the XML property of the SPListItem object that represents the task, and passes it to the form as a secondary data source.

When the user submits their changes to the form, the hosting page calls the AlterTask method, passing the SPListItem object and the updated data as parameters. This method updates the specified SPListItem object with the specified XML.

SharePoint Server 2010 processes the XML passed in the AlterTask method, passing the SPItem method in the following way: If a named property in the XML matches a property in the SPWorkflowTask object, SharePoint Server 2010 promotes the XML property value into the matching object property. Any XML properties that do not match properties of the SPWorkflowTask object are concatenated and stored in a "spill over" field on the object. You can use the GetExtendedPropertiesAsHashtable methods to access this data.

For ease of programming, we strongly recommend that developers create content types for their task types, and that each task content type schema match the schema of its designated edit task form exactly. This approach provides one-to-one mapping of properties, and eliminates the need to parse the "spill over" field to extract additional values.

SharePoint Server 2010 raises an OnTaskChanged event when the AlterTask method is called. To handle this event, add an OnTaskChanged event activity to the workflow. The AfterProperties property of this event contains the task properties that were changed.

See Also


How to: Design InfoPath Workflow Forms (ECM)

How to: Access Workflow Task Form Data in a Workflow in SharePoint Server 2010 (ECM)

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


Workflows in SharePoint Server 2010 (ECM)

InfoPath Forms for Workflows (ECM)

Workflow Association and Initialization Forms in SharePoint Server 2010 (ECM)

Workflow Modification Forms in SharePoint Server 2010 (ECM)

Workflow Task Forms in SharePoint Server 2010 (ECM)

Other Resources

Workflow Definition Schema for InfoPath Forms