Association Element (WorkflowConfig)

Applies to: SharePoint Foundation 2010

Contains the information necessary for a declarative rules-based, code-free workflow editor, such as Microsoft SharePoint Designer 2010, to associate a workflow template with the specified SharePoint list in SharePoint Foundation.

<Association
  ListID="Text"
  TaskListID="Text"
  HistoryListID="Text"
  StartManually="true" | "false"
  StartOnCreate="true" | "false"
  StartOnChange="true" | "false"
>
</Association>

Attributes

Attribute

Description

ListID

Required Text. Specifies the GUID of the list to which the workflow should be associated.

TaskListID

Required Text. Specifies the GUID of the task list the workflow should use for workflow tasks, if any.

HistoryListID

Optional Text. Specifies the GUID of the history list the workflow should use for logging workflow history events, if any.

If not specified, the workflow logs workflow history events to a default history list.

StartManually

Optional Boolean. If set to true, the workflow may be manually started by users.

If this attribute is not present, SharePoint Foundation treats the workflow as if this attribute is set to false.

StartOnCreate

Optional Boolean. If set to true, SharePoint Foundation starts the workflow automatically when a new item is created on the list to which the workflow is associated.

If this attribute is not present, SharePoint Foundation treats the workflow as if this attribute is set to false.

StartOnChange

Optional Boolean. If set to true, SharePoint Foundation starts the workflow automatically when an item is changed on the list to which the workflow is associated.

If this attribute is not present, SharePoint Foundation treats the workflow as if this attribute is set to false.

Child Elements

None

Parent Elements

WorkflowConfig Element

Remarks

Once the workflow has been associated with a specific SharePoint list, the values of the following attributes are stored in the SPWorkflowAssociation object for the workflow:

  • The StartManually attribute value is stored in the AllowManual property.

  • The StartOnCreate attribute value is stored in the AutoStartCreate property.

  • The StartOnChange attribute value is stored in the AutoStartChange property.

  • The HistoryListID attribute value is stored in the HistoryListId property.

  • The TaskListID attribute value is stored in the TaskListId property.

Applications created to work as a declarative rules-based, code-free workflow editor can use the AssociateWorkflowMarkup(String, String) method of the websvcWebPartPages Web Service to create a workflow template and associate it to a SharePoint list specifying a workflow markup file, a workflow configuration file, and optionally, a workflow rules markup file.

For more information about creating an application that can act as a declarative rules-based, code-free workflow editor, see Creating Declarative, No-Code Workflow Editors.

Example

The following example shows an Association element for a workflow configuration. The element attributes specify the SharePoint list to which the workflow is associated, the task list the workflow uses, that the workflow can be started manually, and that the workflow starts automatically when a new item is created on the list.

<Association
    ListID="{B8C6FEEA-8066-462E-958D-1B4E90FE1C34}"
    TaskListID="{C64BA541-9D5B-42F3-A989-96F56FD51155}"
    StartManually="true"
    StartOnCreate="true"
>

See Also

Concepts

Workflow Development for SharePoint Foundation

Creating Declarative, No-Code Workflow Editors

Workflow Configuration Schema Overview

SharePoint Designer Workflow Overview