Assign a form to a group in a workflow

Your workflow can collect and store information from many people by assigning them a task to fill out a custom form. Those submitted values are stored in the Tasks list, where you can view them later.
For example, each time that a document is added to your Shared Documents library, you might want several workflow participants to review the document and record their comments in a form. Those comments can then be viewed in the Tasks list by the owner of the document.
Assign form example diagram
To accomplish this, you add the Assign a Form to a Group action to your workflow. The action assigns a task to one or more participants or groups, prompting them to review the new document, to provide their responses on a custom task form and then, when they are done, to click the Complete Task button on their task form.
This article shows you how to assign a form to one or more workflow participants or groups so that the workflow pauses until all of the participants complete their forms.

Which action should I use to create this task?

Tasks are the primary way for a workflow to interact with participants in the workflow. If you want your workflow to require work from people or to get information from them, you can have the workflow create and assign a task. Each time a workflow assigns a task, the workflow pauses until that task is completed. The workflow resumes only when a participant clicks the Complete Task button on the task form.
There are three different actions that create a task, and each action is designed for a specific kind of situation:
  • Collect Data from a User    This action assigns a task to a single user or group and returns the unique ID of the task item that stores the user's answers, so that the workflow can later look up this information by using the ID. With this action, you use the Custom Task Wizard to design a custom task form that collects the information you want. This action creates a task that can be assigned only to a single user or group. If you assign this task to a group, each member of the group receives a task notification, but only one task item is created, and the workflow pauses only until the first person to respond completes the task. For more information about this action, see the article http://sharepointdesigner2007-workflow.blogspot.com/p/collect-data-from-user-in-workflow.html
  •  
  • Assign a Form to a Group    This action assigns a form to one or more users, and then stores the responses as values in the Tasks list. Unlike the previous action, this action can assign a task separately to multiple people, and the workflow pauses until each person completes their task before it resumes. Also unlike the previous action, this action does not return the ID of the task item for any of the responses, so the workflow cannot look up and use that information later as the basis for making comparisons or decisions. With this action, you also use the Custom Task Wizard to create a custom task form.
  • Assign a To-do Item    Unlike the other two task actions, this action creates a task form that has no form fields to fill out but instead uses a form where the user simply clicks a Complete Task button when the task is finished. This task can be assigned separately to multiple people, and the workflow pauses until each person marks their task as complete. This action does not return the ID of the task item — and doesn’t really need to because the task does not collect any information that you might want to reference later. http://sharepointdesigner2007-workflow.blogspot.com/p/assign-to-do-item-in-workflow.html
The following table summarizes this information.

Action Returns the task ID for workflow lookups? Creates multiple tasks? Enables you to define fields on the task form?
Collect Data from a User Yes No Yes
Assign a Form to a Group No Yes Yes
Assign a To-do Item No Yes
No

In addition, several limitations apply to all three task actions:
  • When a workflow assigns a task to a group that is identified by a single alias or address, the workflow creates only one task item, which is then shared by the entire group. Any member of the group can edit that single task form and click the Task Complete button. To assign individual tasks to multiple users (only possible with the Assign a Form to a Group or Assign a To-do Item action), enter each user individually in the Select Users dialog box.
  • All of the tasks assigned by a single workflow action must be completed before the workflow can continue. If the workflow action assigns individual tasks to six participants, for example, you cannot direct the workflow to continue after only three of the six tasks are completed.
  • After a task is assigned to a participant by the workflow, that task cannot be transferred to any other participant (by delegation, forwarding, etc.). However, anyone with the default Contribute permission level to the Tasks list can edit the task item and thus allow the workflow to continue.
  • A workflow can use each task only once. After you create a task by using the Custom Task Wizard, there is no way to reuse that task later in the workflow. You can create another task that performs the same function, but the task's name will have to be different and unique.

What is a custom task form?

Each time that you use one of the three task actions to create a task, Microsoft Office SharePoint Designer 2007 automatically generates a custom task form for that task. The custom task form is the page that is presented to the workflow participant when they edit the task in the browser.
When you create a task by using the Assign a Form to a Group or Collect Data from a User action, the custom task form can have as many form fields as you choose to create. In this example, the participant is asked to provide text answers to two questions.
Custom task form for group assignment
In Office SharePoint Designer 2007, the custom task form appears as an .aspx page in the folder for that workflow. The file name of the custom task form corresponds to the name that you give the task in the Custom Form Wizard.
Custom task form in Folder List
Custom task forms are attached to the site's default master page and contain a Data Form Web Part to interact with the workflow. The custom task form can be customized for layout and appearance — for example, you can attach a different master page or modify the styles. However, to change what fields appear on the form, you must use the Custom Task Wizard in the Workflow Designer. You cannot change the form fields by editing the Data Form Web Part directly. If you make other customizations to the Data Form Web Part (for presentation and not for functionality), note that those changes are lost each time that the workflow is recompiled. Customizations to the rest of page are preserved.
To change the fields on the custom task form, you must open the workflow in Office SharePoint Designer 2007 (File menu, Open Workflow command). When you open the workflow and edit the task by using the Custom Task Wizard, you see the following warning.
Warning message
If you modify the custom task form and recompile the workflow, all running instances of the workflow continue to run using the new form. If you delete or modify fields (for example, by changing their type or renaming them), a workflow error will occur if the running instances of the workflow reference data that is not what is expected. For example, a running workflow may do a lookup and expect a field to contain data (be non-empty) but now it is empty, or the field may have changed type. Therefore, it is important not to make any change that deletes, renames, or otherwise alters form fields that currently running workflow instances may attempt to reference.
In addition to the custom task form, each time that you use one of the three task actions to create a task, Office SharePoint Designer 2007 automatically generates a content type for that task in the Tasks list. The content type defines the available fields and what format they use, as you specified in the Custom Task Wizard. The name of the content type matches the name that you give the task in the Custom Form Wizard. For example, if you create a task named "Review document", you will see a content type with that name on the Settings page of the Tasks list.




We recommend that you modify workflow content types only by opening the workflow in Office SharePoint Designer 2007, and not by modifying the columns or other settings for the content type in the browser. Modifying the content type in the browser can potentially break the custom task form that it is associated with.

Assign a form to a group

You use the Assign a Form to a Group action to create the custom task form and to assign the task to one or more participants.
In this example, the task is to review a document in the Shared Documents library and to enter their responses in the custom task form.
  1. On the File menu, point to New, and then click Workflow.
  2. On the first page of the Workflow Designer, name the workflow, choose the list or library that the workflow will be attached to, and then select the check boxes for the start options that you want.
First page of Workflow Designer
  1. Click Next.
  2. Click Actions, and then click Assign a Form to a Group.
If this action does not appear in the list, click More Actions to see the full list.
  1. In the action, click a custom form.
Workflow designer page with cursor selecting a custom form
  1. On the first page of the Custom Task Wizard, click Next.
  2. On the next page, in the Name box, type a name for this task.
 Note   The task name must be unique in the current site.
  1. In the Description box, type any general instructions to the recipient of the task.
This description appears at the top of the custom task form, so include here any instructions that you want the workflow participant to see, not just a general description.
Second page of Custom Task Wizard
  1. Click Next.
  2. Click Add to define a custom form field for this task.
  3. In the Field name box, type a name for this field.
  4. In the Description box, type the question for which this form field is storing the answer.
  5. In the Information type list, choose an option that formats the field appropriately for the type of information that you are collecting.
Add Field dialog box
  1. Click Next.
  2. The next page of the wizard varies depending on the Information type that you chose on the previous page. Specify the settings that you want.
  3. Repeat steps 10–15 for each field that you want to appear on the form.
  4. When all of the fields that you want are defined, click Finish in the Custom Task Wizard.
The following illustration shows how this task will be displayed to the workflow participant in the browser when they edit the task. This is the custom task form — Review Document.aspx — that you just designed by using the Custom Task Wizard.
Custom task form for group assignment
Back in the Workflow Designer, you still need to set the other parameter in the Assign a Form to a Group action.
  1. In the action, click these users.
Workflow Designer page with cursor selecting these users
  1. In the Select Users dialog box, type a name or e-mail address, or click an existing user or group in the list, and then click Add.
Repeat this step to include any other participants to whom you want to assign this task.
 Notes 
  • The Assign a Form to a Group action creates one task for each person and group that you include here. The action does not expand the group and assign a separate task to each person in the group. 
  • Instead of entering a specific user or group name or e-mail address, you can store such information in a separate list, and then use a workflow lookup to get this information. This way, various users and groups can be configured as workflow participants without you having to modify the workflow itself.
  1. When all of the appropriate participants appear in the Selected Users box, click OK.
In this example, the workflow will now create and assign the task each time that a new document is added to the Shared Documents library. The workflow will pause until every task is marked complete. The next action or step can be whatever your process requires — for example, you can configure the workflow to send an e-mail notification when all of the participants complete their reviews.

View the information submitted in the forms

After the workflow collects the information submitted in the custom task form, the easiest way to view this information is on the Workflow Status page for this instance of the workflow.
  1. In the list or library where the item that started the workflow resides, in the column for the appropriate workflow, click the status entry for that item.
Workflow status column in Shared Documents library
  1. On the Workflow Status page, in the Tasks section, click the link in the Title column for any participant to see their responses in that task item.
Link to workflow task on Workflow Status page
Unlike the Collect Data from a User action, the Assign a Form to a Group action does not return the ID of the tasks that it creates, so you cannot use a workflow lookup to retrieve the responses and send them in a workflow e-mail message.
A workflow also cannot look up the Workflow Instance ID for the currently running workflow, which is required to build the query string portion of the URL for the Workflow Status page. Therefore, a workflow e-mail message cannot include a link to the Workflow Status page for the current workflow.