Partager via


Associate an SPD workflow with a specific task list

Hello all,

Stephen here again with a simple but useful workflow tip.

If you have used the out-of-box workflows included with MOSS, you have probably noticed that you can select which task list a workflow uses.

Unfortunately, the Workflow Designer in SPD does not provide this option this release. However, there is a relatively easy way to associate a specific task list with a specific SPD workflow.

The first time that you compile an SPD workflow, it is associated with a task list in the current site. This configuration information is stored in the wfconfig.xml file.

Changing this configuration information is not recommended or supported. However, you can determine which task list SPD will pick when you compile your workflow for the first time.

How does SPD pick a task list?

If there is more than one task list in a site, SPD picks the first task list that is returned in the list of lists from the server — and this list of lists is sorted alphabetically by list name.

View your site in the browser, and then click View All Site Content. On the All Site Content page, you can see that any SPD workflows created in this site will be associated with the AAA Tasks list, instead of the default Tasks list. Why? Because it is the first task list to appear alphabetically in the list of lists.

So to associate an SPD workflow with a specific task list, simply do the following:

  1. In the browser, create a new task list and name it so that it appears first alphabetically in the list of lists on the All Site Content page.

  2. In SPD, create a new workflow and compile it (click Finish in the Workflow Designer).

  3. In the browser, rename the new task list so that at least one other task list appears above it alphabetically on the All Site Content page – for example, name it "Workflow Tasks," as shown here.

As long as at least one other task list appears alphabetically above your new task list, subsequent workflows created in SPD will not be associated with the new task list. In effect, you have associated a specific SPD workflow with a specific task list, and then reserved that task list so that other SPD workflows will not use it.

Why is this useful? Here are a couple of scenarios:

  • Your workflow uses the Assign a Form to a Group action. The information that workflow participants submit in the form is stored in items in a task list. To make this information easier to view and report, you want this workflow to have its own dedicated task list.
  • Your workflow uses the Collect Data from a User action. You want the task notifications for this workflow to have more specific instructions than those provided by the default automatic task notifications. So you want a secondary workflow running on a task list to send custom task notifications. To do this, you need to turn off the automatic task notifications on the task list — but you don't want to turn off these notifications for other workflows running in the site, just this workflow. So this workflow (and its secondary workflow) requires a separate task list.

There are many more reasons why you might want to associate a workflow with its own task list. So enjoy.

Cheers, Stephen

Comments

  • Anonymous
    April 06, 2008
    PingBack from http://www.virtual-generations.com/2008/04/06/sharepoint-2007-link-love-03-06-2008/

  • Anonymous
    August 08, 2008
    Thanks, helped me alot man....

  • Anonymous
    December 24, 2008
    Nice blog ! Good job, Thanks for the information

  • Anonymous
    January 05, 2009
    An interesting byproduct of selecting the first tasks list is that if you want the workflow to run automatically task list items, you must create a different task list with a name that comes alphabetically before the name of the task list on which you wish to create the workflow. Otherwise, SharePoint Designer will not allow the workflow to start automatically on the task list items. I have a more detailed explanation of the behavior here: http://thingsthatshouldbeeasy.blogspot.com/2007/10/sharepoint-designer-2007-workflow-on.html

  • Anonymous
    January 14, 2009
    great idea and an even better solution ... thanks

  • Anonymous
    January 20, 2009
    I know that this is surely not Microsofts recommendation, but what other arguments speak against directly modifying the wfconfig.xml file and change the GUID of the associated task list (TaskListID=...). You can find the ID by going to the settings of the workflowlist, copy it from the URL (listedit.aspx?List=GUID URL encoded) and replace the URL encoded characters with their cleartext ( curly brakets at the beginning and end, dashes in between).

  • Anonymous
    August 08, 2009
    hi i need to make a workflow with about 7step,i create a list when the list is created a task assigned to a managment that i collect data from this user it means if managment fill approve form next task assigned to the secend managmnet and this process continuously happen in this case i have a problem the all of the task assigned to this peoble show in one TASK LIST but i like  everybody see task in her/his task list could you please help me ?