22.2. A Workflow Scenario: Document Approval

Approval is one of the most common workflow scenarios. Most processes implement some sort of approval mechanism, as it's innate to the nature of the business implementations to secure approval from senior resources before an operation can be started or continued. Workflow Designer provides Web designers with a number of workflow conditions and actions that can be used to implement approval workflows.

22.2.1. Understanding the scenario

An author working on a document uploads it to the Review document library on the SharePoint site. The act of uploading the document to this library starts a workflow and sends an e-mail to an editor for document review. The editor reviews the document and makes a decision about whether it should be approved or rejected. If the document is approved, it's moved to the Approved document library by using another workflow.

22.2.2. Implementing the scenario by using Workflow Designer

To implement this scenario by using Workflow Designer, follow these steps:

NOTE

To successfully send an e-mail, you must properly configure the SharePoint Outgoing e-mail settings.

  1. In a Web browser, open the SharePoint (WSS v3) site where you want to implement this workflow. First, you need to create two document libraries — Documents for Review and Approved Documents — for storing the documents.

  2. Choose Site Actions Create in the SharePoint site to open the Create web page for the web site Web page.

  3. On the Create page, click Document library in the Libraries section.

  4. In the new Web page that opens, specify the name Documents for Review for the document library, keep the defaults, and then click Create. The newly created document library opens in the All Documents view.

  5. Click the Settings action menu and then click Create Column to open the Create Column Web page. As shown in Figure 22.11, create a column of type Choice with the approval status (for example, Approved, Rejected, etc.) that the document can have.

  6. Click OK. Using the previous steps, create another document library called Approved Documents with a column that tracks the approval status. After you create the two document libraries, you can start designing the workflow in Workflow Designer.

  7. Open the SharePoint site in SharePoint Designer and then choose File New Workflow to open Workflow Designer.

  8. As shown in Figure 22.12, specify a name for the workflow, associate it with the Documents to Review document library, set it to start whenever an item is created, and then click Next.

  9. Specify a name for the workflow step and then choose the Build Dynamic String workflow action from the More Actions dialog box (which you access by choosing Actions More Actions).

    Figure 22.11. Creating an approval status column for the document library
  10. Click the dynamic string hyperlink in the action description sentence Store dynamic string in Variable: Variable1 to open the String Builder dialog box. You use the String Builder dialog box to create a subject line for the e-mail that's to be sent to an editor when the document is uploaded.

  11. As shown in Figure 22.13, click Add Lookup in the String Builder dialog box to open the Define Workflow Lookup dialog box and then specify the lookup query to retrieve the name of the document being uploaded.

  12. Using this process, build the dynamic string to be used as the subject line for the e-mail to be sent to an editor. An example is shown in Figure 22.14.

  13. After the string is complete, click OK to return to Workflow Designer.

  14. Click Variables to open the Workflow Local Variables dialog box and then rename the Variable1 created automatically to store the dynamic string to a relevant name, as shown in Figure 22.15.

    Figure 22.12. Creating the workflow association in Workflow Designer

    Figure 22.13. Using the Define Workflow Lookup dialog box to retrieve the document name

    Figure 22.14. Building a dynamic string by using the String Builder dialog box

    Figure 22.15. Renaming the variable for the Build Dynamic String workflow action
  15. Choose Actions More Actions to add the Send an E-mail workflow action to the step and then click this message in the workflow action sentence to open the Define E-mail Message dialog box.

  16. As shown in Figure 22.16, use the Define E-mail Message dialog box to create an e-mail to be sent to an editor notifying him or her that the document has been uploaded for review.

    Figure 22.16. Using the Define E-mail Message dialog box to create an e-mail message
  17. After you create the e-mail message, click OK to return to Workflow Designer.

  18. Click Check Workflow to check for errors and then click Finish to publish the workflow and associate it with the Documents for Review document library. Now you can create another workflow for notification and processing once an editor reviews the document and posts his or her decision to the Documents for Review document library. The editor would do so by changing the approval status column. A workflow starts whenever the document is changed, checks whether the status column has been set to a specific value, and performs an action based on the status.

  19. Choose File New Workflow to open Workflow Designer. As shown in Figure 22.17, specify the name for the new workflow, associate it with the Documents for Review document library, and then specify it to start whenever an item is changed.

  20. Click Next.

  21. Choose Conditions Compare any data source to use the If value equals value condition sentence, click the first value hyperlink, choose the current item's DocumentApprovalStatus column, and then set the second value hyperlink to Rejected approval status.

    Figure 22.17. Creating a secondary workflow for processing based on the approval status
  22. Click the Add Else If Conditional Branch link to add another conditional branch for specifying an Else If condition. As shown in Figure 22.18, create the conditional statement "If status is rejected, then do this else or do something else."

  23. Using previous steps, use the Build Dynamic String and the Send an E-mail workflow actions to create an e-mail message to notify the author that the document was rejected by the editor. This is shown in Figure 22.19.

  24. If the document is approved, the document needs to be copied to the Approved Documents document library. To do this, in the Else If branch, choose Actions More Action and then choose the Copy List Item workflow action. This places the Copy item in this list to this list action sentence in the Else If branch.

  25. Click the first this list hyperlink. The Choose List Item dialog box opens, with the Current Item value selected in the List dropdown menu.

  26. Keep the defaults in this dialog box and then click OK.

    Figure 22.18. Creating the condition branches for the workflow step
  27. Click the second this list hyperlink in the action sentence and then choose the Approved Documents document library. The completed sentence is shown in Figure 22.20.

  28. Next, you need to notify the author that the document has been approved. You do this by using the Build Dynamic String and Send an E-mail workflow actions, as used previously in this exercise. The completed workflow definition is shown in Figure 22.21.

  29. Ensure that the workflow doesn't have any errors and then click Finish to publish the workflow files to the SharePoint site. As described earlier in the description for this scenario, the first workflow notifies an editor when the author uploads a document to the Documents for Review document library. The second workflow notifies the author when an editor changes the approval status. If the document is approved, the document is copied to the Approved Documents document library.

Figure 22.19. Creating a e-mail message for notification

Figure 22.20. Configuring the Copy List Item workflow action

Figure 22.21. The process for the second document approval workflow

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.224.32