Example of the Collect Data From User Widget

Example of the Collect Data From User Widget

Normally, you can collect data for a workflow only on an initialization form when the workflow starts. However, the are many instances when you might need to collect some information later in the workflow. You can use the Collect Data From User widget to do that. Here is an example.

Scenario

The scenario for this example is to create a site workflow that can be started by someone in the HR department when they need to request travel preference information from an employee.

Creating the Workflow

request travel wf.jpgThe workflow will look like that shown. In addition to the Collect Data From User and the Send Email widgets, it also has an Initialization Form.

Open the Workflow Conductor Studio from any list and follow these steps to build this workflow:

Step Action
1. init form menu spotlight.jpgClick the Init Form link in the main menu to open the Initialization Form editor.
2. Add one parameter to the Initialization form. Call it Employee and make it a Single line of text.

init form2.jpg
3.

Create a variable to store the WF Task ID created in the Collect Data From User widget.

collect data variable.jpgClick the Variables link in the main menu to open the Variable Settings form.

Create a variable of type Single line of text and call it varWFTaskID.

4.

Configure the Collect Data from User widget.

collect data config.jpgDouble click the Collect Data from User widget to open the widget properties.

For the User property, click the lookup icon (hourglass.jpg) to open the Define Lookup dialog.

lookup employee.jpgOn the Define Lookup dialog, click the Workflow Variables category and select the Parameter: Employee from the list. Click Add to save your selection and close the Define Lookup dialog.

Icon-Tip Parameters are fields defined in the initialization form. Variables are created on the Variables page.

On the widget properties page, click the dots.jpg icon for the Form property to open the Edit User Form dialog. Enter Collect airline info as the Form Name and add the three fields shown below by clicking the Add Field button in the lower left corner of the dialog. When done, click OK to save the form and close the Edit User Form dialog.

collect data form2.jpg

Fill in the other information in the widget properties. When ready, click Save on the widget properties form to save and close the widget properties.

5.

Configure the Send Email widget.

send email properties.jpgFor the To property, click the hourglass icon (hourglass.jpg) to open the Define Lookup dialog.

select initiator.jpgSelect Initiator from the Easy Reference area.

Click Add to save the selection and close the Define Lookup dialog.

Configure the Subject line by clicking the hourglass (hourglass.jpg), entering Airline preference information for, and selecting Parameter: Employee from the Workflow Variables section of the Define Lookup dialog. Click Save to save the Subject and close the Rich Text Editor.

subject line1.jpg

email body.jpgConfigure the email Body by clicking (dots.jpg) to open the Rich Text Editor. Configure the message like that shown.

To add the lookups for form values, click Add Lookup and configure them like that shown below.

Icon-Tip Rather than entering a name for the workflow tasks list, lookup to the Easy Reference called Workflow Task List Name. This way, the form values will always be retrievable, even if the person who associates the workflow to new a list changes the name of the associated workflow tasks list.

field lookup1.jpg

Click Save to save the message Body and close the Rich Text Editor. Then click Save to save the widget properties and close the Properties dialog.

6. wf settings.jpgClick the Settings link in the main menu to open the Workflow Settings form. Name the workflow Request travel info site workflow and make sure the manual workflow start option is enabled.
7. publish as site workflow.pngSave and publish the workflow as a Site Workflow by clicking Publish as Site Workflow from the main menu.

Running the Workflow

This workflow was published as a Site Workflow. Site workflows are not associated with any list, so you do not start them from a list item. Follow these steps to start this Site Workflow:

Step Action
1. open site contents.jpgView Site Contents by clicking the gear icon (gear icon.jpg) and selecting Site Contents.
2. On the Site Contents page, click Site Workflows.

site workflows.jpg
3. site workflows2.jpgClick the desired workflow to start it. The initialization form is presented.

Fill in the appropriate information and then click Start Workflow.

site workflows start.jpg
4. email example.jpgFor this particular workflow, an email is sent to the Employee entered in the initialization form. The email has a link to a SharePoint workflow task form, which is shown here.
5. Clicking the link in the email opens the task form in SharePoint.

travel pref form.jpg

The employee enters values and clicks Save to complete the task.
6.

A final email containing the employee’s travel preferences is sent to the workflow initiator.

final email.jpg

Icon-Tip Instead of sending the travel preferences in an email, you could also create an item in a list and send the link to the item via email. This alternative stores the preferences in SharePoint for future reference, rather than in an email sent to an individual.