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.
- Open SharePoint Designer 2010.
- Click Open Site.
- In the Open Site dialog, enter the URL of your local SharePoint website, e.g., http://intranet.contoso.com/Lab03.
- SharePoint Designer will open your SharePoint website and provide a dashboard for navigating its contents.
- In the site navigation toolbar, click Workflows to display the list of workflows that are currently available in your SharePoint Online site.
- Click Workflows on the ribbon, and click Import from Visio.
- Browse to the vwi file that you exported in the previous exercise, select it, and click Next.
- 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.
- Click Finish to finish importing the workflow.
- 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.
- Click the text “ID3” in the workflow designer and replace it with “Non-Standard Business Purchase Approval Workflow”.
- The text “ID3” is the name of the workflow activity; changing it to a more descriptive name is for documentation purposes and helps readability.
- In the breadcrumbs near the top of the window, click Non-Standard Business Purchase Approval
- This screen provides some high-level information about the workflow, as well as options for configuring the workflow, such as setting its start options.
- 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.
- 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.
- In the Customization section, click Edit workflow.
- Click the “Approval” link the “Start Approval process on this item with these users” link.
- This screen allows you to customize the approval process.
- In the Task Process ribbon, click Initiation Form Parameters.
- The Association and Initiation Form Parameters dialog contains a list of parameters that the workflow uses during the initiation and association process.
- Click Add to add a new initiation parameter to capture the business rationale of the request from the user.
- 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).
- Click Next and leave the default value for this parameter as blank.
- The Business Rationale Initiation form parameter is now visible in the list of initiation and association parameters.
- Click OK to close the Association and Initiation Form Parameters.
- Under Customization, click Return to Workflow.
- 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.
- Click the “these users” link on the “Start Approval process on this item with these users” step of the workflow.
- 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.
- 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.
- 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.
- In the Instructions textbox, enter “Business Rationale: “, and then click the Add or Change Lookup button.
- In the dialog, set Data Source to Workflow Variables and Parameters.
- Set Field from source to Parameters: Business Rationale.
- Set Return field as to As String and click OK.
- The assigned task should now appear as follows:
- Click OK.
- The next step in the workflow is to log a message to the history list.
- 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.
- Click the … button to bring up the String Builder dialog.
- 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.
- 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.
- Click OK.
- The message that will be logged to the workflow history list should appear as follows:
- The workflow up to this point should appear as follows:
- You’re now ready to implement the logic for checking if the item was approved and taking the appropriate action.
- 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.
- 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.
- Click OK.
- In the workflow, click the “this test” link and select “equals”.
- Click the “value” link and select “Yes”.
- The condition should appear as follows:
- The next step in the workflow is to email the user when the request has been approved.
- Click the “these users” link in the “Email these users” step to bring up the Define E-mail Message dialog.
- In the To box, click the lookup button to open the Select Users dialog.
- Under Or select from existing Users and Groups:, select User who created current item and click Add >>.
- Click OK.
- Set the Subject to “Your request has been approved”.
- In the body of the email, add the text “Your request for … has been approved”.
- 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.
- The email message definition should appear as follows:
- Click OK.
- If the user’s request is rejected by the approver, delete the item from the Non-Standard Business Purchase Requests list.
- 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.
- Email the user to let them know that their request has been rejected.
- 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.
- Save your changes.
- The completed workflow is shown below:
- On the Workflow tab in the ribbon, click Publish to publish the workflow to your SharePoint site.
SharePoint Designer will validate the workflow and publish it to the Lab03 site.
Task 3 – Associate the Purchase Request Approval Workflow
- Open your Lab03 site, e.g. http://intranet.contoso.com/Lab03.
- Open the Non-Standard Business Purchase Requests list from the Quick Launch.
- Select List >> Workflow Settings from the ribbon
- 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.
- In the next screen, select the Non-Standard Business Purchase Approval Workflow workflow template name the workflow Non-Standard Business Purchase Approval.
- Click Save on the next screen.
Task 4 – Test the Non-Standard Business Purchase Request Approval Workflow
- Open your site and select the Non-Standard Business Requests list
- Click the Add new item link to create a new item in the list.
- 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
- Select the newly created item in the list and click Workflows in the ribbon.
- 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.
- 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”.
- Click Start to start the workflow.
- 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.
- Click on the workflow instance.
- 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.
- The Workflow History section shows items that have been entered automatically into the workflow history list.
- 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.
- On the same screen, in the Tasks section, click the title of the approval task.
- 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.
- Click Approve to approve the request.
- 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.
- Click on the workflow instance.
- 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.