In this walkthrough, i am going to show you how to create a Site Workflow that Writes to a Custom List !! sounds complicated but trust me it is not 😉
So lets Get started 😉
The following example uses a site workflow to capture employee reviews submitted by employees,
which their managers will then need to review and approve.
To do this, you’ll create a custom list, customize the fields on the form that are used to start the
workflow, look up the manager of the person submitting the workflow, write it all to a list, and then
assign a task to the manager. Follow these steps:
1.Open your site in SPD.
2. Click the Workflows link in the Navigation pane on the left.
3. From the ribbon, click the Site Workflow button to create a new workflow.
4. Name the workflow Employee Reviews and click OK. The Workflow Designer for the new workflow will automatically open.
5. With the Workflow Designer open, you should see a blinking horizontal orange line, which is used to indicate where the next action or condition will be inserted. But, before you add any steps to this workflow, from the ribbon, click the Initiation Form Parameters button shown in the Figure:
This allows you to define parameters that are used to collect data when the workflow is started. In this case, you want the user to fill out the form and then use the information that was entered throughout the workflow.
6. From the “Association and Initiation Form Parameters” dialog, click the Add button.
7. Name the field Employee Name, choose “Single Line of Text” as the Information type, and click Next. Leave the default value blank and click Finish.
8 Once you’ve completed adding the fi rst parameter you should be returned to the “Association
and Initiation Form Parameters” dialog. You need to create another parameter, so click the Add button and name the field Rating. Choose Choice as the Information type (that is, a menu to choose from), and click Next. On the ColumnSettings screen, enter the values shown in the Figure and click Finish.
9 Click the Add button to add another field. Name this field Comments, set it as “Multiple lines of text,” and click Next. Then click Finish. Click the OK button from the “Association and Initiation Form Parameters” screen.
10 The Workflow Designer should open and there should be a horizontal, orange blinking cursor in a box titled Step 1. From the ribbon, click the Action button and then click “Send an Email” from under the Core Actions section, as shown inthe Figure.
Optionally, instead of clicking the Actions button, you can start typing and SPD will try to figure out what you want it to do.
11 The new action will be added to the workflow, but it still must be configured. To do that, click the “these users” link in the action, which will open the Define E-mail Message dialog.
12 Click the phone book icon at the right of the “To:” field to open the Select Users dialog. Select “Workflow Lookup for a user”, then click the Add button. Choose the following values from the “Lookup for Person or Group” dialog shown in the Figure :
➤➤ Data Source — Workfl ow Context
➤➤ Field from source — Initiator
➤➤ Return field as — Email
Once complete, click OK and you’ll be taken back to the Select Users dialog. Click OK again on this screen to
define the rest of the fields in the e-mail.
13. For the “Subject” field, enter the text Employee Review Received. Optionally, here you could also click the ellipsis (…) button to open the string builder to create a dynamic subject that could pull values from the user, or from the workflow itself.
14. In the body field of the e-mail, enter the text Your review has been sent to your manager who will schedule a meeting within the next week, as shown in the Figure .
Again, you can optionally click the “Add or Change Lookup” button in the bottom-left corner of the dialog to add dynamic text from the workflow itself. When you are finished, click the OK button to return to the Workflow Designer.
15. From the ribbon, click the Action button and select Create List Item. This adds the action to
the workflow. To configure it, click the “this list” link in the action, which opens the Create
New List Item dialog.
16. Click the Add button to open the Value Assignment dialog. Select the field to set as Employee Name. Then, to assign the value, click the function button. Choose the following values:
➤➤ Data Source — Workflow Variables and Parameters
➤➤ Field from source — Parameter: Employee Name
➤➤ Return field as — As String
When you have finished, click OK, and then click OK again to return to the Create New List Item dialog.
17. Repeat Step 16 to add the Rating and Comments fields from the parameters captured in the form, as shown in the Figure. Once you have added all of the fields, click OK.
18. Back in the Workflow Designer, click the Action button again and choose “Assign a To-do Item.”
19. Click the link for “a to-do item” and the Custom Task Wizard will open. Click Next. On the second
page of the wizard, enter Employee Review in the Name field and click Finish.
20. Next, from the Workflow Designer, click the “these users” link in the “create to-do item” action that you’ve been editing. From the Select Users dialog, click “Workflow Lookup for a User,” and then click Add. The “Lookup for Person or Group” dialog window will open.
21. Set the following values for the lookup in the top section of the window:
➤➤ Data source — User Profiles
➤➤ Field from source — Manager
➤➤ Return field as — Login Name
22. For the fields at the bottom of the “Lookup for Person or Group” dialog shown in the Figure,
choose Account Name from the drop-down menu for the Field value. Next, click the function button
to the right of the Value field. In the dialog that opens, set the fields as follows:
➤➤ Data source — Workflow Context
➤➤ Field from source — Initiator
➤➤ Return field as — Login Name
The name of the manager is being returned for the purpose of assigning a task to the manager,
which is why the Login Name is used as the return field.
23. Click OK on all the dialogs to accept the changes.
24. The workflow is now complete and should look similar to this Figure:
From the ribbon,click the Save button. Before the workfl ow can be used, it must fi rst be published. To do so,
click the Publish button on the ribbon, as shown in the Figure.
You’re done !!! 🙂
To try the site workflow, go back to your site and click Site Actions ➪ View All Site Content. At the top of the page, click the Site Workflows link.
Click the Employee Reviews link, as shown in the Figure, which opens the page where you can fill out the form to start the workflow. Fill out the form and click Start. To make this form easier to access, you can copy the form’s URL and create a link directly to the form.
You can see the workflow has kicked off by clicking Site Actions ➪ View All Site Content, and then clicking the Site Workflows link. The workfl ow task will be listed under the My Running Workflows section.
Click the link for the workflow to go to the Task Item that’s been created. You should see that the task has been assigned to the manager of the user who started the workflow.
Hover your mouse over the Title of the workflow task item and select it to edit the task item. If you log in as a user who can edit the task, you can click the “Complete task” button. When you view the status of the workflow, the outcome should show as Completed.
If you go back to the Employee Review list, you’ll see that a new item has been created and the information entered into the form has been added, as shown in the Figure:
See U next time 😉