Share via


Workflow Association and Initialization Forms (Office SharePoint Server 2007)

Before the workflow starts, you can display association and initialization forms to your users so that they can set parameters and other information for the workflow in advance. Association forms address the workflow as it applies to a specific list, library, or content type; initialization forms address the workflow as it applies to a specific SharePoint item.

You can also include preassociation data in the workflow template definition. For example, you might want to prepopulate fields on your association form with default values.

For more conceptual information about association and initialization forms, see Workflow Association and Initiation Forms (Windows SharePoint Services) in the Windows SharePoint Services 3.0 SDK.

Specifying Association Forms

As with all workflow forms, you specify the association form of a workflow in the workflow template definition XML. To do this, you edit two XML elements.

  1. Set the value of the AssociationURL attribute of the Workflow element to "_layouts/CstWrkflIP.aspx". This is an .aspx page included with Office SharePoint Server 2007; the page includes an InfoPath Forms Services Web Part to host the Microsoft Office InfoPath 2007 workflow association form:

    AssociationURL ="_layouts/CstWrkflIP.aspx"
    

    Note

    Office SharePoint Server 2007 supports absolute or server-relative paths in the workflow template definition. You must express all form path URLs in one of these formats. For example, an absolute path, such as "http://site/library/page.aspx"; or a server-relative path, such as "/layouts/page.aspx". Office SharePoint Server 2007 does not support link fix-up in workflow template definitions.

  2. Add an Association_FormURN element to the Metadata element in the workflow template definition. Use this element to specify the URN of the Office InfoPath 2007 form you want to use for workflow association. For example:

    <Association_FormURN>urn:schemas-microsoft-
        com:office:infopath:workflow:ReviewRouting-Assoc
    </Association_FormURN>
    

    If you want to provide custom data to the association form, you can store this information in the AssocationData element. For example, you can use this element to store default values you want to pass to the association form when it is displayed. The AssocationData element can contain any valid XML.

For more information about the workflow definition schema, see Workflow Definition Schema in the Windows SharePoint Services 3.0 SDK.

Association Form Processing

When an administrator selects a workflow to associate with a given list, library, or content type, Office SharePoint Server 2007 displays the Add a New Workflow page; here the administrator can specify settings common to all workflows, such as the workflow definition, initiation conditions, and whether the workflow runs on items, folders, or both.

When the administrator clicks the Next button on this page, Office SharePoint Server 2007 examines the AssociationURL attribute of the Workflow element in the workflow template definition, to determine the proper .aspx page to load. For an Office InfoPath 2007 form, the developer sets this value to _layouts/CstWrkflIP.aspx. Office SharePoint Server 2007 loads this page, which contains an Office InfoPath Forms Services Web Part for hosting the custom form. The page then examines the Association_FormURN element of the workflow template definition XML to determine the proper Office InfoPath 2007 form to host. In addition, this Web Part passes any data stored in the AssocationData element to the Office InfoPath 2007 form.

When the administrator submits changes to the form, CstWrkflIP.aspx passes the data back to Office SharePoint Server 2007 as an XML string. The data is stored in the AssociationData property of the SPWorkflowAssociation object that represents that workflow association.

Specifying Initiation Forms

To specify an Office InfoPath 2007 workflow initiation form, you must edit two elements in the workflow template definition.

  1. Set the value of the InstantiationURL attribute of the Workflow element to "_layouts/IniWrkflIP.aspx". This is an .aspx page included with Office SharePoint Server 2007; the page includes an Office InfoPath Forms Services Web Part to host the Office InfoPath 2007 workflow initiation form:

    InstantiationURL="_layouts/IniWrkflIP.aspx"
    

    Note

    Office SharePoint Server 2007 supports absolute or server-relative paths in the workflow template definition. All form path URLs must be expressed in one of these formats. For example, an absolute path, such as "http://site/library/page.aspx", or a server-relative path, such as "/layouts/page.aspx". Office SharePoint Server 2007 does not support link fix-up in workflow template definitions.

  2. Add an Instantiation_FormURN element to the Metadata element in the workflow template definition. Use this element to specify the URN of the Office InfoPath 2007 form you want to use for workflow initiation. For example:

    <Instantiation_FormURN>urn:schemas-microsoft-
        com:office:infopath:workflow:ReviewRouting-Init:1033
    </Instantiation_FormURN> 
    

Initiation Form Processing

When a user starts a workflow on a given item, Office SharePoint Server 2007 examines the InstantiationURL attribute of the Workflow element of the workflow template definition XML to determine the proper .aspx page to load. In the case of an Office InfoPath 2007 form, the developer sets this value to "_layouts/IniWrkflIP.aspx". Office SharePoint Server 2007 loads this page, which contains an Office InfoPath Forms Services Web Part to host the custom form. This page then examines the Instantiation_FormURN element of the workflow template definition XML to determine the proper Office InfoPath 2007 form to host. In addition, the page passes, as an XML string, the association data stored in the AssociationData property of the appropriate SPWorkflowAssociation to the Office InfoPath 2007 form. This data serves as the primary data source of the form.

When the user submits changes to the form, IniWrkflIP.aspx passes the data back to the Windows SharePoint Services object model, as part of calling the StartWorkflow method.

The workflow manager in Office SharePoint Server 2007 creates an instance of the workflow on the SharePoint item. The workflow manager passes the data gathered using the initiation form to the OnWorkflowActivated event of the workflow itself.

See Also

Tasks

How to: Design an InfoPath Form for a Workflow in Office SharePoint Server 2007
How to: Access Association and Initiation Form Data in a Workflow
How to: Design a Workflow Form to Use Association and Initiation Data

Concepts

Workflows in Office SharePoint Server 2007
InfoPath Forms for Workflows
Workflow Modification Forms (Office SharePoint Server 2007)
Workflow Task Forms (Office SharePoint Server 2007)

Other Resources

Workflow Definition Schema for InfoPath Forms