SharePoint 2010 Workflow Example – Custom Association and Initiation Forms

A year of so ago I wrote a couple of posts on MOSS 2007 workflows, specifically around the creation of custom Association and Initiation forms using InfoPath. While neither of these tasks are really very difficult (once you have figured out how), I think most would agree that the whole process is a great deal more messy that it should be.

Now that we are near the release of SharePoint 2010 (it went RTM last week and ships May 12, for those who have not seen the 2 million other posts letting you know), I thought I would revisit these same activities in SharePoint 2010 to demonstrate the fact that the process is whole lot less messy.

(Note that I have not had time to do screen captures as I did in my previous examples. If you have trouble following what I have done, leave a comment and I will add the pictures in).

The first couple of steps are identical to the previous version:

1) Create a new site.

2) Create a new document library (make sure you add at least one document to the library for testing later).

Now things get a little different.

3) Run SharePoint Designer 2010, and open your site.

4) In the Site Objects list on the left hand side, select Workflows. You will see the list of workflows defined on the site, which at this point will just be built in workflows. You can edit these workflows (though I wouldn’t) or you can create a copy of one of them to serve as a starting point. In this example, however, we will start from scratch.

5) In the Ribbon you will see three choices for creating a new workflow:

  • A List Workflow: Creates a workflow associated with a specific list. These workflows can only be associated to one list, and cannot be re-used
  • A Reusable Workflow: Creates a workflow which is not pre-associated with a particular list. These workflows can be later associated with one or more lists or content types. They can also be exported as WSP packages and reused across multiple sites.
  • Site Workflows: Site workflows are not associated with a list or content type. They are initiated from the Site Actions menu, and their instances are not connected to list items.

In this example, we will create a Reusable Workflow. Give your workflow a name, a description if you want, and leave the Content Type selection at “All”, and click Ok.

6) You will now see the workflow editor in SharePoint Designer. The main canvas is where you design the logic of your workflow. Make sure your insertion point is in Step 1, and from the Action gallery of the Insert section of the Ribbon, select “Log to History List”. Click on “this message” in the design area, and enter text to be logged. I used “My Workflow Started”.

7) Now for the point of this example – we will create an Association and Initiation parameter. In the Ribbon, click on Initiation Form Parameters.

Click Add…, and define a new parameter. Mine is called “MyParameter”, is of type “Single Line of Text”, and will be shown on both the Association and Initiation forms (you can also have a parameter which is only shown on Association, or only shown on Initiation). Once you have defined your parameter, click Ok.

8 ) Now you can add a reference to your parameter to you “Log to History List” activity. Open the message to be logged, and click the ellipses (…) to display the string builder tool. Click Add or Change Lookup, and select “Workflow Variables and Parameters” as the Data Source. Then select your parameter in the “Field from Source” drop down, and select String as the “Return Field As” selection. Click Ok, and then Ok again.

9) Now we should be ready to test things. In the Ribbon, click Publish. This will make the workflow available in your site.

10) Navigate to your site in the browser, and open the document library you created for this example. At the top of the page, under Library Tools, select Library. On the far right side of the Ribbon, select the Workflow Settings drop down, and select Add a Workflow. Select your custom workflow from the list, give your workflow association a name, and leave all the other settings at the default values. Click Ok.

11) A custom association form will now be displayed, asking for your parameter. Enter a default value for the parameter (I used “Default Value”). Click Save.

12) Now return to your document library, and select one of your documents. From the menu for the document, select Workflows. On the Workflows page that is displayed, select your workflow. A custom initiation form is now displayed, asking for the parameter you defined. Enter a value and click Start.

13) You will now be taken back to your document library. Notice that the document you used for the test now has a column named for your workflow, and has a value there of Completed. Click on Completed to view the workflow status page. You should now see the status for this workflow instance, and at the bottom you should see your logged message, with the value you entered for the parameter in your Initiation form.

While this procedure has almost as many steps as the previous examples for MOSS 2007, it is obviously a lot less messy to create and access Association and Initiation parameters in SharePoint 2010. From here, you can go back to SharePoint Designer, from which you can see the actual form (.XSN) used for your workflow, and you can open it up and customize it in InfoPath.


6 thoughts on “SharePoint 2010 Workflow Example – Custom Association and Initiation Forms

  1. Hi,
    I created a workflow to move a wikipage to a particular folder and set it to start on item’s creation.
    However when i create a new page, it goes to the page library and its workflow status shows completed(Not moving to the folder).
    Then , on re-initiating the workflow on that page from its context menu, the page is moved to the desired folder.

    But I want the page to be automatically moved as soon as it is created by a user. Please help….
    Note:- workflow code written to move the page is working fine.

    Reply ASAP.
    Thanks and regards,


    1. Is the “Completed” status you are seeing from your workflow – I know, seems like a silly quetion, but I am thinking it might be colliding with a built-in approval workflow?

      Is your workflow set to run automatically on item creation, or to be initiated manaually?

      Have you got any log messages written out to indicate what is actually going on while the workflow executes?



      1. Yes, The workflow status shows “Completed”,

        and it is set to run automatically on item creation.

        and i have to rerun the workflow from the item’s contxt menu to get the work done.

        sorry, no log messages


  2. need screen shot of above example.
    And need more example on sharepoint 2010 workflow created by visual studio 2010.

    Plz send me ur mail id.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s