Exercise 2: Implement Workflow in SharePoint Designer 2010

Task 1 – Import Visio Workflow into SharePoint Designer 2010

In this task, you will import the Visio workflow into your SharePoint Online site using SharePoint Designer 2010.

  1. Open SharePoint Designer 2010.
  2. Click Open Site.

  3. In the Open Site dialog, enter the URL of your local SharePoint website, e.g., https://intranet.contoso.com/Lab03.
  4. SharePoint Designer will open your SharePoint website and provide a dashboard for navigating its contents.

  5. In the site navigation toolbar, click Workflows to display the list of workflows that are currently available in your SharePoint Online site.

  6. Click Workflows on the ribbon, and click Import from Visio.

  7. Browse to the vwi file that you exported in the previous exercise, select it, and click Next.

  8. Change the name to Purchase Approval. Choose the type of workflow to import as Reusable Workflow, and select Purchase Request as the content type to attach the workflow to.

    Note:
    Creating the workflow as a reusable workflow will allow you to later associate the workflow with other lists. It also allows you to later export the workflow as a .wsp that can be later deployed to other environments.
  9. Click Finish to finish importing the workflow.
  10. The workflow is imported into SharePoint Designer and is ready to edit.

Task 2 – Implement Workflow Logic in SharePoint Designer

In this task, you will implement the Non-Standard Business Purchase Approval workflow logic using SharePoint Designer.

  1. Click the text “ID3” in the workflow designer and replace it with “Non-Standard Business Purchase Approval Workflow”.

    1. The text “ID3” is the name of the workflow activity; changing it to a more descriptive name is for documentation purposes and helps readability.

  2. In the breadcrumbs near the top of the window, click Non-Standard Business Purchase Approval

  3. This screen provides some high-level information about the workflow, as well as options for configuring the workflow, such as setting its start options.

  4. Check the “Show workflow visualization on status page” checkbox.
    Note:
    Checking this checkbox allows you to use the Visio document you created in the previous exercise to visually show the state of the workflow and the path that the user takes through the workflow.
  5. Make sure the Disable manual start option checkbox is unchecked.
    Note:
    When a workflow is started manually, it allows you to capture information from the user in an InfoPath initiation form. This enables you to collect data from the user that is specific to the workflow and not appropriate to store in the associated list.

    If the workflow is set to start automatically when a new item is created, you can’t use an InfoPath initiation form to collect data from the user when the workflow is started.
  6. In the Customization section, click Edit workflow.

  7. Click the “Approval” link the “Start Approval process on this item with these users” link.

  8. This screen allows you to customize the approval process.

  9. In the Task Process ribbon, click Initiation Form Parameters.

  10. The Association and Initiation Form Parameters dialog contains a list of parameters that the workflow uses during the initiation and association process.

  11. Click Add to add a new initiation parameter to capture the business rationale of the request from the user.
  12. Set the Field name to Business Rationale, and Information type to Multiple lines of text and leave the Collect from parameter during set to Initiation (starting the workflow).

  13. Click Next and leave the default value for this parameter as blank.
  14. The Business Rationale Initiation form parameter is now visible in the list of initiation and association parameters.

  15. Click OK to close the Association and Initiation Form Parameters.
  16. Under Customization, click Return to Workflow.

  17. Click the “this item” link on the “Start Approval process on this item with these users” step of the workflow. Choose Current Item from the list to specify that the workflow should execute on the current item in the list.

  18. Click the “these users” link on the “Start Approval process on this item with these users” step of the workflow.
  19. To designate that the person to whom the task is assigned to must be a member of the Approvers group, click the lookup button to the right of the Participants textbox, search for the Approvers group and add it to the Selected Users list.

  20. In Task Request section of the Select Task Process Participants dialog, select the Title text box and enter Please review this Non-Standard Business Purchase Request to specify the title of the task that is assigned to the user.

  21. We would like the business rationale entered by the user requesting the non-standard purchase to appear in the task description assigned to the approver.
  22. In the Instructions textbox, enter “Business Rationale: “, and then click the Add or Change Lookup button.
  23. In the dialog, set Data Source to Workflow Variables and Parameters.
  24. Set Field from source to Parameters: Business Rationale.
  25. Set Return field as to As String and click OK.

  26. The assigned task should now appear as follows:

  27. Click OK.
  28. The next step in the workflow is to log a message to the history list.
  29. Click the “this message” link in the “then Log this message to the workflow history list” to log a new message in the workflow history list. Later when you open a workflow instance to check on its progress, you will see these messages displayed there.
  30. Click the button to bring up the String Builder dialog.
  31. Under Name:, add the text: “New request entered by ” and click the Add or Change Lookup button to add the login name of the user that created the item.

  32. For Data source select Current Item, Field from source select Created By and Return field as select Login Name to return the formatted login name.

  33. Click OK.
  34. The message that will be logged to the workflow history list should appear as follows:

  35. The workflow up to this point should appear as follows:

  36. You’re now ready to implement the logic for checking if the item was approved and taking the appropriate action.
  37. Click the “value” link in the “If value this test value” workflow step to edit the value and click the fx button to open the Define Workflow Lookup dialog.
  38. Under Data source: select Workflow Variables and Parameters and for Field from source: select the Variable:IsItemApproved workflow variable designating if the item was approved.

  39. Click OK.
  40. In the workflow, click the “this test” link and select “equals”.
  41. Click the “value” link and select “Yes”.
  42. The condition should appear as follows:

  43. The next step in the workflow is to email the user when the request has been approved.
  44. Click the “these users” link in the “Email these users” step to bring up the Define E-mail Message dialog.
  45. In the To box, click the lookup button to open the Select Users dialog.
  46. Under Or select from existing Users and Groups:, select User who created current item and click Add >>.

  47. Click OK.
  48. Set the Subject to “Your request has been approved”.
  49. In the body of the email, add the text “Your request for … has been approved”.
  50. In the text in the previous step, select and click the Add or Change Lookup button.

    Use the Current Item data source to pull the Title field and return it formatted as a string.

  51. The email message definition should appear as follows:

  52. Click OK.
  53. If the user’s request is rejected by the approver, delete the item from the Non-Standard Business Purchase Requests list.
  54. In the Else branch of the condition, in the “Delete item in this list” workflow step click the “this list” link and select Current Item and click OK.

  55. Email the user to let them know that their request has been rejected.
  56. In the “Email these users” step, click the “these users” link to bring up the Define E-mail Message dialog.

    Create an email message to let the user know that their request was rejected using the same process used above.

  57. Save your changes.
  58. The completed workflow is shown below:

  59. On the Workflow tab in the ribbon, click Publish to publish the workflow to your SharePoint site.
  60. SharePoint Designer will validate the workflow and publish it to the Lab03 site.

Task 3 – Associate the Purchase Request Approval Workflow

  1. Open your Lab03 site, e.g. https://intranet.contoso.com/Lab03.
  2. Open the Non-Standard Business Purchase Requests list from the Quick Launch.

  3. Select List >> Workflow Settings from the ribbon

  4. Select Purchase Request from the drop down list and click Add a workflow. Your workflow is now associated with the Non-Standard Business Request list.

  5. In the next screen, select the Non-Standard Business Purchase Approval Workflow workflow template name the workflow Non-Standard Business Purchase Approval.

  6. Click Save on the next screen.

Task 4 – Test the Non-Standard Business Purchase Request Approval Workflow

  1. Open your site and select the Non-Standard Business Requests list
  2. Click the Add new item link to create a new item in the list.
  3. Create a new item in the list, for example:
    • Title: SharePoint Conference
    • Requested By: << Enter your account here >>
    • Description: SharePoint Conference 2010 in Anaheim, CA
    • Price: 4999

  4. Select the newly created item in the list and click Workflows in the ribbon.

  5. The workflows screen displays all the workflows that you can start on this list item. Click the Non-Standard Business Purchase Approval workflow to start an instance of the workflow on the list item.

  6. The workflow initiation form appears and prompts the user to enter the business rationale for their request. Enter “I’d like to learn all about SharePoint Online”.

  7. Click Start to start the workflow.
  8. Select the new item in the list, and then click Workflows in the ribbon to see the status of the workflow. You can now see an instance of the Non-Standard Business Purchase Approval workflow under the RunningWorkflows section.

  9. Click on the workflow instance.
  10. The Workflow Visualization web part uses Silverlight and Visio Services to display a visual state of the workflow and the path that the user is taking through the workflow.

  11. The Workflow History section shows items that have been entered automatically into the workflow history list.

  12. To approve the workflow, you would typically have to log out and log back in with a user who is a member of the Approvers group. In this case, you are already logged in as an administrator so you can approve the workflow.
  13. On the same screen, in the Tasks section, click the title of the approval task.

  14. The Workflow Task dialog contains information about the task that was assigned to the Approvers group.

    Note the Business Rationale text entered in the workflow initiation form is visible in the Consolidated Comments section.

  15. Click Approve to approve the request.
  16. Go back to the Non-Standard Business Purchase Requests list and open the workflows page for the request list item.

    You can see the instance of the Non-Standard Business Purchase Approval workflows in the Completed Workflows section.

  17. Click on the workflow instance.
  18. The workflow visualization is updated to show the path that the user took through the workflow.

    The checkmarks on the individual steps denote that the step was executed during the workflow.