Workflow Designer allows you to create workflows that can be used to collect information from one or more users. The information collected can then be processed based on the logical requirements of the process. This scenario illustrates the use of the workflow actions provided by Workflow Designer to gather information from users.
The sales department publishes weekly newsletters consisting of content targeted for the employees in the department. Each week, information is collected from subdepartments Sales A, Sales B, and Sales C and is then collated to form a single newsletter that's sent to the entire department. Each subdepartment has a point of contact who's responsible for submitting newsletter content for that subdepartment. Once the newsletter content is collected, it's reviewed by a senior manager and, on approval, subsequently sent to the employees as an e-mail.
Open the SharePoint site where you want to create the list that the workflow uses to store and collate data collected from the users. To implement the preceding scenario using Workflow Designer, follow these steps:
Choose Site Actions Create to open the Create page.
As shown in Figure 22.22, type ContentSalesA in the Name text field and then choose Multiple lines of text as the type for this column.
Keep the other settings as default and then click Create to create the column.
Using the previous steps, create two more columns — ContentSalesB and ContentSalesC — in the NewsLetters list.
Open the site in SharePoint Designer and then choose File New Workflow to open Workflow Designer.
As shown in Figure 22.23, type a name for the workflow, associate it with the NewsLetters list, and then specify for it to start whenever a new item is created.
Click Variables to open the Workflow Local Variables dialog box. Here you create three workflow variables — SalesA, SalesB, and SalesC — of type List Item ID for storing the IDs of the tasks created for collecting data from the users. This is shown in Figure 22.24.
After you create the workflow variables, click Next in Workflow Designer.
Specify a name for the first step. As shown in Figure 22.25, this step requires that you run all the actions in parallel.
Click the Run All Actions in Parallel menu option. This ensures that all the users are simultaneously sent the tasks for collecting newsletter content.
Choose Actions More Actions and then choose the Collect Data from a User workflow action. This shows the Collect data from this user (Output to Variable: collect) action sentence in Workflow Designer. You use this action to send the users task items for collecting newsletter data.
NOTE
The workflow is paused until all the task items have been completed.
Read the information on the Welcome screen on the Custom Task Wizard and then click Next.
As shown in Figure 22.26, type a name and description for the task for easy reference later in the workflow.
Click Next.
Click Add to open the Add Field dialog box, create a field called ContentSalesA of type Multiple lines of text, as shown in Figure 22.27, click Next, and then click Finish.
Click Finish to complete the Custom Task Wizard and return to Workflow Designer.
Click the this user hyperlink to open the Select Users dialog box and then specify the user to whom the task should be assigned.
Click the Variable: collect hyperlink and select the workflow variable SalesA. It's important to understand that Collect Data from a User workflow action returns the List Item ID of the task that's assigned to the user. You use the workflow variable to store this List Item ID for future use in the workflow. The completely configured workflow action is shown in Figure 22.28.
Using previous steps, configure two more Collect Data from a User workflow actions for the Sales B and Sales C department. For this exercise, you can name the tasks TaskSalesB and TasksSalesC and the fields ContentSalesB and ContentSalesC. The completed set of actions is displayed in Figure 22.29.
In the Set this field dropdown, select ContentSalesA, click the fx button to open the Define Workflow Lookup dialog box, and then specify a lookup query to locate the content that the user submitted in the task that was assigned in the previous step. Always keep in mind that at runtime, the workflow can't proceed to this step (CollateData) until all the tasks in the first step (CollectDataFromPOCs) are completed.
To implement the lookup query "Select ContentSalesA field in the Task list item whose List Item ID is equal to the value stored in the Sales A workflow variable" by using the Define Workflow Lookup dialog box, in the Lookup Details section, select Tasks in the Source dropdown menu and ContentSalesA in the Field dropdown menu.
In the Find the List Item section, select Tasks:ID in the Field dropdown list box and then click the fx button next to the Value text field. Another Define Workflow Lookup dialog box opens.
In this Define Workflow Lookup dialog box, select Workflow Data in the Source dropdown menu, Variable: SalesA in the Field dropdown menu. This is shown in Figure 22.30.
Click OK. The complete lookup query described in the previous steps is shown in Figure 22.31.
Click OK twice to complete the field value assignment.
Repeat the previous steps to create value assignments for the ContentSalesB and ContentSalesC columns in the NewsLetters list and then click OK to return to Workflow Designer. The completed Update List Item dialog box should look as shown in Figure 22.32.
Check the workflow for errors and then click Finish to complete the workflow and deploy it to the SharePoint site.
In the SharePoint site, you can now initiate the workflow by creating a new item in the NewsLetters list. The workflow should create three task items and then assign them to the specified users. As shown in Figure 22.33, when the user edits the task, he or she is given a choice to complete the task by clicking Complete Task. When all the tasks are completed, the workflow proceeds to the second step and then updates the list item created in the NewsLetters list with the data collected via the tasks from the users.
3.148.105.87