Whenever you develop Sharepoint 2010, Project server 2010 or Infopath 2010 workflows using Visual studio 2010 you may face the error which says “Error occurred in deployment step 'Activate Features': Unable to locate the workflow's association data. To restore the association data to the workflow, restart the workflow settings wizard by selecting the workflow node in Solution Explorer and then clicking the ellipsis button (…) on one of the properties in the Properties window that has an ellipsis button”. Don’t be panic!!. 🙂 Before going to the solution of this error, lets understand some basic concepts:
A workflow is made up of a sequence of events such as workflow initiation, task creation, and task completion. When you add a workflow, you specify a task list and a history list that workflow instances of that workflow association will use to track the events for the workflow. The task list contains items that users interact with and enter data into while interacting with a workflow. The workflow history contains key information about each event including date, status, participant, and description.
When you add a workflow association, you assign a task list and history list to use with the selected workflow. You can use the default task list, select another existing task list, or create a new one.
Workflow tasks—as any other tasks—are displayed in task lists. When the user navigates to a task list, the tasks it contains are displayed based on the selected View and the access control list (ACL) rights of the user. A workflow can have different types of tasks, but all the tasks from a given workflow association are contained on the same task list. A given task list, however, can contain the tasks for multiple workflow templates and associations.
The workflow History list is an hidden list that contains key information about each workflow event including date, status, participant, and description;the Visual studio 2010 wizard will create it for you.By default the workflow history is not visible 60 days after a workflow completes or is cancelled;you will find more information about the Workflow Auto Cleanup Job here
When we create a workflow using Visual Studio, Visual Studio does this association for us. That means normally we do not have to bother much about this association. While adding the workflow itself, Visual studio will create History list and Task list association of the workflow. But for any reason this if association goes away, e.g. you mistakenly change or delete this from designer file of workflow…etc. You will face error during deployment.
There are two solutions to this problem:
- In the Visual studio solution explorer, right click on the Workflow --> Properties. Set the Auto Associate attribute to false. Try redeploying your workflow, it should work now. 🙂 As in this case , we have not auto associated the workflow with any history list or task list, user will have to manually go and create the association.
2. If you still want the workflow to AutoAssociate, to reduce the steps for manually associating it, you need to follow these steps:
- In the Visual studio solution explorer, right click on the Workflow àProperties. Click on the ellipsis button (…) at the right most to the History List Attribute.
- On the Next Screen Specify the Name you wish for your workflow. The workflow will appear with this name on the site.
- On the Next screen, check the checkbox which says "Yes, associate this workflow with the following libraries and lists. if this step is ommitted, you must manually associate the workflow after it is created." The history list dropdown and task list dropdown will contain all the lists those are available for association. Keep the default ones or choose the one you wish to. Click on finish.
- Now you will see the History List and Task list are associated with the workflow.
- Try redeploying your workflow now. It should not give any deployment error. 🙂
Depending upon your requirement i.e. whether you need auto association of workflow with history and task list, you need to choose the solution.
Other References :