Use Case

In most processes, an approval routing workflow will help to streamline the approval process, and also create an audit trail of what happened in the approval. This tutorial details several ways to route workflow to recipients including:

  • Using AAD (Azure Active Directory) to route to managers
  • Routing to a managers manager
  • Using a list when AAD is not updated

The first steps of this tutorial will go through creating a simple Equipment Request process to use with optional workflow processes based on the use case.

Creating Related Lists

Two lists will be needed for this application. The first list will detail the available equipment and its cost, and the second will detail departments and approvers for routing using a SharePoint list.

  1. Navigate to the Site Contents of your SharePoint site and create a new Custom List called Equipment List.
  2. Navigate to the List Settings and under the Columns add a column called Price as the type Currency with the default settings.
  3. In the Advanced settings, set the Attachments option to Disabled.
  4. Add a few items for the available equipment. Here is the data used in the example:

    Lenovo Edge 2

    $630.00

    Toshiba Satellite Radius

    $450.00

    Asus 2-in-1 15.6"

    $900.00

    Microsoft Surface 3

    $400.00

  5. In the List tab, select the K2 Application.
  6. Select Create New Application.
  7. In the Data option select Site and all of its subsites and then click OK.
  8. Navigate to the Site Contents of your SharePoint site and create a new Custom List called Equipment Approval.
  9. Navigate to the List Settings and under the Columns rename the Title column Department.
  10. In the Advanced settings, set the Attachments option to Disabled.
  11. Add two columns of the type Person or Group with the default settings. Name one First Approver and one Second Approver. Add a few departments with approvers. This example uses IT, HR and Marketing.
    Note:  For testing, use accounts that will not route to the actual approver.
  12. Navigate to K2 Appit for SharePoint and select the SmartObjects link under Artifacts in the Administration section.
  13. In the List tab, select the K2 Application.
  14. Select Create New Application.
  15. In the Data option select Site and all of its subsites and then click OK.

Creating the Base Application

This step will walk through creating the essential pieces to the base of the application. These steps will create a reference to the department for use later on, as well as a reference to the user.

  1. Navigate to the Site Contents of your SharePoint site and create a new Custom List called Equipment Request.
  2. Navigate to the List Settings and under the Columns add the following columns with their default settings:

    Justification

    Multiple Lines of text

    Opened by

    Person or Group

    Request Date

    Date and Time

    Needed by

    Date and Time

    Requested Equipment

    Single line of text

    Request Cost

    Currency

    Department

    Single line of text

    Comments

    Multiple lines of text

    Status

    Single line of text

  3. Select the K2 Application from the List tab in the ribbon.
  4. Select Create New application and select Data, Forms, and Reports then click OK.
  5. Check out and then select Edit on the New Equipment Request View.
  6. Select the Requested Equipment Text box and use the Change control button to change the control to a Drop-Down List.
  7. In the Properties menu of the Requested Equipment Drop-Down List select the ellipses next to the Type under the Data Source. Image
  8. Select the ellipses next to the SmartObject option, and select the Equipment List SmartObject under the SharePoint 2013 folder.
  9. Change the Value to ID and the Display to Title and then select OK.

    Image
  10. Select the Rules tab and select Add Rule. In the Events tab choose Changed from the selection of the Event.
  11. Add a rule to Set a control’s properties. Select the Request Cost Text Box and then click configure.
  12. Expand the Controls and then the Requested Equipment Drop-Down and from the Equipment List SmartObject drag the Equipment List.Price field onto the Text destination. Select OK and OK again to close.
    Image
  13. Select the Request Cost field, and check the Read-Only option.
  14. Select the Status field and check the Read-Only option.
  15. Select the Department Text Box and use the Change Control button to change the control to a Drop-Down List.
  16. In the Properties menu of the Department Drop-Down List select the ellipses next to the Type under the Data Source.
  17. Select the ellipses next to the SmartObject option, and select the Equipment Approval SmartObject under the SharePoint 2013 folder.
  18. Change the Value to ID and the Display to Department and then select OK.
  19. Select Finish to save your changes and return to the Application elements page.
  20. Check out the Edit Equipment Request View and repeat steps 6-19.
    Image
In the following section choose one of three walkthroughs to design a workflow to route your request for approval. Here are the avalible workflow walkthroughs:
  • Approval Routing – Basic User Task Assignment

  • Approval Routing – AAD Manager’s Manager Lookup

  • Approval Routing – SharePoint List

Approval Routing – Basic User Task Assignment

Some workflows may require generic routing. For these kind of approval a user, user’s manager or SharePoint group can be used to assign a user task.

  1. Select Workflow from the New drop-down menu on the Equipment Request Application elements page.
  2. Name the Workflow Equipment Request Workflow and choose When a SmartForm is submitted as the start option and then select OK.
    Image
  3. From the top ribbon, select List Items in the category drop-down and drag a Update List Item step onto the Start step of the workflow.
    Image
  4. Select the Equipment Request from the List Item drop-down and then click Next.
    Image
  5. Type Submitted into the Status value and then click Finish.
  6. Click the Update List Item text and rename the step Status Submitted.
  7. Select the Workflow Step Outcomes. Add an outcome and name it continue and then click OK.
  8. From the top ribbon, select the General category and drag a User Task onto the continue step of the workflow.
    Image
  9. Name the task Manager Approval with the instructions Please review the equipment request. For the actions type Approve, Reject and Query. Then click Next. Click Next again to assign the Participants.
    Image
  10. Here the user has the following options:
    Drag the Manager from the Search pane into the task group.
    Image
    Use the People Search to find a specified user.
    Image
    Use the Group Search to assign the task to a group.
    Image
  11. Select an option and then select Notify and Next, then Finish. Notice that the three actions have generated outcomes.
  12. Select the outcomes option on the user task. Select approve and click Edit. Here the outcome rules can be configured for One or multiple approvers before moving to the next step. The status will be updated in the next steps to create values that SharePoint views can filter on in order to sort requests.
    Image
    Image
  13. Change the Category drop-down to List Items and add a step to Update List Item to the Approve outcome.
  14. Select the Equipment Request from the List Item drop-down and then click Next.
  15. Change the status to Manager Approved and click Finish.
  16. Change the step name to Status Manager Approved.
  17. Add a Workflow Step Outcome and call it continue.
  18. Repeat steps 13-17 for the Reject and Query steps with the status of Manager Rejected and Manager Queried.
  19. In the General tab add a Send E-mail step the continue outcome of the Manager Approval step.
  20. In the Context Browser expand the workflow Context and add the Originator E-mail to the To: line.
    Image
  21. In the subject line type Equipment Request Approved.
  22. Configure an approval email. Use the Equipment Request under the Item References to drag field values into the body of the message. Here is an example:
    Image
  23. Rename the step Approval Email.
  24. Repeat steps 19-23 for the Status Manager Reject Step and name the step Reject Email.
  25. Drag a User Task (SmartForms) step onto the continue outcome of the Status Manager Query step.
  26. Name the step Query Request with the instructions Please update your Equipment Request. For the outcomes type Cancel Request and Resubmit then click Next and Next again.
  27. Drag the Originator onto the Task Group and select the Notify Participants when they receive a work item option and then click Next and then Finish.
  28. Select List Items from the category drop down and drag an Update List Item step onto the Cancel Request outcome. Select the Equipment Request List Item and click Next.
  29. In the Status filed type Cancelled for the value and then click Finish.
  30. Change the Step name to Status Cancelled.
  31. Repeat steps 28-30 for the Resubmit outcome with the status of Resubmitted and name it Status Resubmitted.
  32. Add a Workflow Step Outcome to the Status Resubmitted step.
  33. Name the step Reassign and change the Linked To value to Status Manager Queried.
    Image
  34. Publish and test your workflow.
    Image

Approval Routing – AAD Manager’s Manager Lookup

In a scenario where Azure Active Directory is used for organizational hierarchy, in a multi-step approval process it necessary to route items to multiple user’s managers. In this workflow, we’ll use references to correctly route an approval through multiple users.

  1. Select Workflow from the New drop-down menu on the Equipment Request Application elements page.
  2. Name the Workflow Equipment Request Workflow and choose When a SmartForm is submitted as the start option and then select OK.
    Image
  3. From the top ribbon, select List Items in the category drop-down and drag an Update List Item step onto the Start step of the workflow.
    Image
  4. Type Submitted into the Status value and then click Finish.
  5. Click the Update List Item text and rename the step Status Submitted.
  6. Select the Equipment Request from the List Item drop-down and then click Next.
    Image
  7. In the Status field type Submitted and then click Finish.
  8. Select the Workflow Step Outcomes by hovering over the right corner of the object. Add an outcome and name it continue and then click OK.
  9. Change the category to Azure Active Directory and drag a Get Manager Reference step onto the continue outcome of the workflow.  
  10. Expand the Item References and then the Equipment Request to the Opened by group. Add the Opened by (Email) to the Username and in the Directory select the correct directory then click OK
    Image
  11. Rename the step Manager Reference.
  12. Select the Workflow Step Outcomes. Add an outcome and name it continue and then click OK.
  13. From the top ribbon, select the General category and drag a User Task (SmartForms) step onto the continue outcome of the workflow.
  14. Name the task Manager Approval with the instructions Please review the equipment request. For the actions type Approve, Reject and Query. Then click Next. Click Next again to assign the Participants. (IMG_07)
    Image
  15. In the Context Browser expand the Item References and then the AAD Manager and then add the Mail field to the task group. In the Mail window leave the List Options as Return all items and select OK.
  16. Select an option and then select Notify and Next, then Finish. Notice that the three actions have generated outcomes.
  17. Select the outcomes option on the user task. Select approve and click Edit. Here the outcome rules can be configured for One or multiple approvers before moving to the next step. The status will be updated in the next steps to create values that SharePoint views can filter on in order to sort requests. Close this window by selecting Cancel.
    Image
    Image
  18. Change the category drop-down to List Items and add a step to Update List Item to the Approve outcome.
  19. Select the Equipment Request from the List Item drop-down and then click Next.
  20. Change the Status to Manager Approved and click Finish.
  21. Change the step name to Status Manager Approved.
  22. Add a Workflow Step Outcome to the step and call it continue.
  23. Repeat steps 18-22 for the Reject and Query steps with the status of Manager Rejected and Manager Queried. Here’s what your workflow should look like:
    Image
  24. In the General tab add a Send E-mail step the Reject outcome.
  25. In the Context Browser expand the workflow Context and add the Originator E-mail to the To: line.
    Image
  26. In the subject line type Equipment Request Rejected.
  27. Configure an reject email. Use the Equipment Request under the Item References to drag field values into the body of the message.
  28. Rename the step Reject Email.
  29. Select the Azure Active Directory option in the category drop-down and add a Get Manager Reference step to the workflow on the Status Manager Approved step outcome.
  30. In the Specify Users step, select the User Reference drop-down select the AAD manager reference and change the Reference Name to AAD Managers Manager.
    Image
  31. Rename the step Managers Manager Reference.
  32. On the Managers Manager Reference step add a Workflow Step Outcome and call it continue and select OK.
  33. Select the General option in the category drop-down and add a new User Task (smartForms) to the outcome.
  34. Name the User Task Second Manager Approval with the instructions Please review the Equipment Request, and add outcomes for Approve, Reject and Query and then select Next until the Participants pane.
  35. In the Item References Expand the AAD Managers Manager and add the Mail field to the Task Group. Select Notify Participants and then click Next and then Finish.
  36. Change the Category drop-down to List Items and add a step to Update List Item to the Approve outcome.
  37. Select the Equipment Request from the List Item drop-down and then click Next.
  38. Change the status to Final Approval and click Finish.
  39. Change the step name to Status Final Approved.
  40. Repeat steps 36-39 for the Reject and Query steps with the status of Second Manager Rejected and Second Manager Queried.
  41. Add a continue outcome for the Status Final Approval and Status Second Manager Reject steps.
  42. In the General tab add a Send E-mail step to the continue outcome for the Status Final Approval step.
  43. In the Context Browser expand the workflow Context and add the Originator E-mail to the To: line.
    Image
  44. In the subject line type Equipment Request Approved.
  45. Configure an approval email. Use the Equipment Request under the Item References to drag field values into the body of the message. Here is an example:
    Image
  46. Rename the step Approval Email.
  47. Repeat steps 42-46 for the Status Second Manager Reject Step and name the step Reject Email 2.
  48. Add a Workflow Outcome to the Status Second Manager Query step. Name it continue and change the Linked To value to Manager Approval. This will redirect the step to the first manager.
  49. Drag a User Task (SmartForms) step onto the continue outcome of the Status Manager Query step.
  50. Name the step Query Request with the instructions Please update your Equipment Request. For the outcomes type Cancel Request and Resubmit then click Next and Next again.
  51. Drag the Originator onto the Task Group and select the Notify Participants when they receive a work item option and then click Next and then Finish.
  52. Select List Items from the category drop-down and drag an Update List Item step onto the Cancel Request outcome. Select the Equipment Request List Item and click Next.
  53. In the Status filed type Cancelled for the value and then click Finish.
  54. Change the Step name to Status Cancelled.
  55. Repeat steps 52-54 for the Resubmit outcome with the status of Resubmitted and name it Status Resubmitted.
  56. Add a Workflow Step Outcome to the Status Resubmitted step.
  57. Name the step Reassign and change the Linked To value to Manager Approval.
  58. Publish and test your workflow.
    Image

Approval Routing – SharePoint List

In a scenario Azure Active Directory may not have the most current approval information based on user’s managers, or a specific route may need to be taken depending on the users department. In this workflow, we’ll use a SharePoint list to route an approval through multiple users based on the department selected.

  1. Select Workflow from the New drop-down menu on the Equipment Request Application elements page.
  2. Name the Workflow Equipment Request Workflow and choose When a SmartForm is submitted as the start option and then select OK.
    Image
  3. From the top ribbon, select List Items in the category drop-down and drag an Update List Item step onto the Start step of the workflow.
    Image
  4. Type Submitted into the Status value and then click Finish.
  5. Click the Update List Item text and rename the step Status Submitted.
  6. Select the Workflow Step Outcomes by hovering over the right corner of the object. Add an outcome and name it continue and then click OK.
  7. Change the Category to List Items and drag a Get List Reference step onto the continue outcome of the workflow.  
  8. Choose the correct Site Collection from the drop-down and navigate to the Equipment Approval List and then select Next.
    Image
  9. In the next screen expand the Inline Functions and the Conversion group. Add a To Integer conversion to the ID field. In a second screen, expand the Item References then Equipment Request and add the Department to the Value. This will take the Department field in the form and recognize it as a number to be used in the lookup.
    Image
  10. Select the Workflow Step Outcomes. Add an outcome and name it continue and then click OK.
  11. From the top ribbon, select the General category and drag a User Task (SmartForms) step onto the continue outcome of the workflow.
    Image
  12. Name the task Manager Approval with the instructions Please review the equipment request. For the actions type Approve, Reject and Query. Then click Next. Click Next again to assign the Participants.
    Image
  13. In the Context Browser expand the Item References and then the Equipment Approval and then add the Email field of the First Approver to the task group.
    Image
  14. Select an option and then select Notify and Next, then Finish. Notice that the three actions have generated outcomes.
  15. Select the outcomes option on the user task. Select approve and click Edit. Here the outcome rules can be configured for One or multiple approvers before moving to the next step. The status will be updated in the next steps to create values that SharePoint views can filter on in order to sort requests. Close this window by selecting Cancel.
    Image
    Image
  16. Change the Category drop-down to List Items and add a step to Update List Item to the Approve outcome.
  17. Select the Equipment Request from the List Item drop-down and then click Next.
  18. Change the Status to Manager Approved and click Finish.
  19. Change the step name to Status Manager Approved.
  20. Add a Workflow Step Outcome to the step and call it continue.
  21. Repeat steps 16-20 for the Reject and Query steps with the status of Manager Rejected and Manager Queried.
  22. In the General tab add a Send E-mail step the Reject outcome.
  23. In the Context Browser expand the workflow Context and add the Originator E-mail to the To: line.
    Image
  24. In the subject line type Equipment Request Rejected.
  25. Configure an approval email. Use the Equipment Request under the Item References to drag field values into the body of the message.
  26. Rename the step Reject Email.
  27. On the Status Manager Approve step add a Workflow Step Outcome and call it continue and select OK.
  28. Select the General option in the category drop-down and add a new User Task (smartForms) to the outcome.
  29. Name the User Task Second Manager Approval with the Instructions Please review the Equipment Request, and add outcomes for Approve, Reject and Query and then select Next until the Participants pane.
  30. In the Context Browser expand the Item References and then the Equipment Approval and then add the Email field of the Second Approver to the task group.
  31. Select Notify participants and then click Finish.
  32. Change the category drop-down to List Items and add a step to Update List Item to the Approve outcome.
  33. Select the Equipment Request from the List Item drop-down and then click Next.
  34. Change the Status to Final Approval and click Finish.
  35. Change the step name to Status Final Approved.
  36. Repeat steps 32-35 for the Reject and Query steps with the status of Second Manager Rejected and Second Manager Queried.
  37. Add a continue outcome for the Status Final approval and Status Second Manager Reject steps.
  38. In the General tab add a Send E-mail step to the continue outcome for the Status Final Approval step.
  39. In the Context Browser expand the workflow Context and add the Originator E-mail to the To: line.
    Image
  40. In the subject line type Equipment Request Approved.
  41. Configure an approval email. Use the Equipment Request under the Item References to drag field values into the body of the message.
    Image
  42. Rename the step Approval Email.
  43. Repeat steps 38-42 for the Status Second Manager Reject Step and name the step Reject Email 2.
  44. Add a Workflow Outcome to the Status Second Manager Query step. Name it continue and change the Linked To value to Manager Approval. This will redirect the step to the first manager.
  45. Drag a User Task (SmartForms) step onto the continue outcome of the Status Manager Query step.
  46. Name the step Query Request with the instructions Please update your Equipment Request. For the outcomes type Cancel Request and Resubmit then click Next and Next again.
  47. Drag the Originator onto the Task Group and select the Notify Participants when they receive a work item option and then click Next and then Finish.
  48. Select List Items from the category drop-down and drag an Update List Item step onto the Cancel Request outcome. Select the Equipment Request List Item and click Next.
  49. In the Status filed type Cancelled for the value and then click Finish.
  50. Change the Step name to Status Cancelled.
  51. Repeat steps 48-50 for the Resubmit outcome with the status of Resubmitted and name it Status Resubmitted.
  52. Add a Workflow Step Outcome to the Status Resubmitted step.
  53. Name the step Reassign and change the Linked To value to Manager Approval.
  54. Publish and test your workflow.
    Image