6. Add a Task Step to Approve or Reject the Site Request

In this step, you add a Task step to the workflow for approving the site request. A task step is a user-oriented step and requires human interaction, for example, making a decision (such as approved or rejected). You can assign a task to one or more recipients. To simplify testing for this tutorial, you will assign the task to yourself.

  1. From the Toolbox > Basic node, add a Task step to the design canvas and connect it to the Set Folio step. Add a Decision step and connect it to the Task step. Configure the Task step as follows:
    • Instructions: Please review the site request and either approve it or reject it.
    • Actions: Approved, Rejected
    • Form: SmartForm > Display Site Requests
      • References: Keep default settings
      • Open Task: Help me configure it
      • Workflow View: Create a new State: Workflow Task
      • Open Task Rule Action: Keep default settings
      • After submit: Keep default settings
      • Summary: Save and Finish
    • Recipients: Originator (keep the default)
    • Email Alert: Personalize the notification by including references from the Context Browser
      Configuring a Task Notification Email
    • Properties: Rename the step: Approve Site Request
    1. Begin by returning to the Toolbox main menu. Click the Toolbox icon in the breadcrumb bar.
      Toolbox Icon
    2. Expand the Basic node, then drag a Task step onto the canvas, below the Set Folio step.
      Adding a Task Step to the Canvas
    3. Connect the Set Folio step to the Task step.
      Connecting Steps
    4. Select the Task step and expand the Configuration Panel. Click the Task tab to make it active, if it is not already. For the INSTRUCTIONS, enter
      Please review the site request and either approve it or reject it.
    5. For the ACTIONS, click Add (+). For the first action, enter
      Approved
      then add a second action,
      Rejected.
      Entering Actions for a Task
    6. Click the Form tab. For the FORM TYPE, select SmartForm. For the FORM, browse to and select the Display Site Requests form. You use the display form because you do not want the recipient to make any changes to the form entries; the display form is read-only. Click OK.
      Your explorer structure may be different than the image below, depending on how you configured SharePoint (such as subsites and list names).
      Browsing to Select a SmartForm
    7. The Open Task on a Form wizard launches.

    8. On the REFERENCES screen, confirm K2 discovered the Site Requests references. Note your references may be collapsed. To view all the references, click the reference title bar. Click NEXT.
      References Screen for the Task Form Wizard
    9. On the OPEN TASK screen, select Help me configure it, then click NEXT.
      Open Task Screen for the Task Form Wizard
    10. On the WORKFLOW VIEW screen, confirm the FORM STATE is Create a new State. The new state name should be Workflow Task. Click NEXT.
      Create New State
    11. On the OPEN TASK RULE ACTION screen, there are no changes. Click NEXT.
    12. On the AFTER SUBMIT ACTION screen, there are no changes. Click NEXT.
    13. The final screen is the Summary. Review the settings, then click SAVE AND FINISH. When you see the Success check, click OK.
      Summary Screen for the Task Form Wizard
    14. Next, you assign the task to a recipient. To simplify testing, assign the task to the originator of the request (you!).
      Click the Recipients tab. Keep the default Originator for the recipient.
      Adding a Task Recipient
    15. Next, you configure the task notification email that K2 sends to the recipient letting them know they have a task assigned. You can personalize the email by using references from the Context Browser. At runtime, K2 replaces references with live content. This allows you to create an email template of sorts, that is personalized for each task recipient.
      Click the Email Alert tab. CHECK the box to Customize Notification. Notice the SUBJECT line and BODY section containing the default email template are now editable.
      Editing the Task Notification Email
    16. To personalize emails, you can add references from the Context Browser.

      The Context Browser provides access to data about the current user and process, as well as functions and SmartObject data. You can use variables dragged from the Context Browser throughout the configuration of workflow steps. At runtime, the variables are replaced with "live" data. There are four tabs:
      • Fields: This section contains references to SharePoint lists, SmartForms, and SmartObjects. You can also create variables to hold and use data within the workflow itself, such as to store record IDs.
      • Functions: This section contains tools for transforming data. Some examples include performing calculations, formatting text, and working with date and time values.
      • SmartObjects: This section contains system and custom SmartObject references.
      • Workflow: This section contains process variables. Examples include the originator's name, email, manager, and folio.
    17. Begin your email customization with the SUBJECT line. Enter the following:
      New Site Request:
      Email Subject Line
    18. Now add the Title reference from the Context Browser. Expand the Context Browser, then expand the Site Requests references. Drag the Title reference to the end of the subject line. At runtime, K2 replaces the Title reference with the actual value entered into the form by the requester.
      Using a SmartObject Reference in an Email Subject Line
    19. Include some information about the request in the message body. This allows the recipient to make a decision without having to open the form or the list item.

    20. Click inside the BODY section after the first line, then add some descriptive text to the email. For example,
      [SPACE] requested a new site titled: [SPACE].
      Customizing an Email Message
    21. From the Context Browser REFERENCES, drag the Title property into the sentence.
      Using SmartObject References in an Email Message
    22. Still in the Context Browser, click the Workflow tab. Expand the ORIGINATOR node, then drag the Display Name to the beginning of the sentence. At runtime, this reference becomes the logged-in user's full name.
      Adding Workflow Context to an Email Message Body
    23. Recipients can action a task in one of three ways:
      • reply to the email itself with one of the actions as the message body
      • open the form and action the task from the form
      • access the K2 Worklist web part in SharePoint and choose an action from the context menu
      By providing some basic information in the email, the recipient can decide which of the methods above is best.

      The final configuration is to rename this step.

    24. Click the Properties tab. Rename the step to
      Approve Site Request
      then collapse the Configuration Panel.
      Changing the Task Step Name and Label
    25. Add a Decision step. The Decision step generates the outcomes (lines) for the Approve Site Request step.

    26. From the Toolbox > Logic node, drag a Decision step below the Approve Site Request step. Connect the two steps. Notice the actions configured in the task step are now represented as outcomes from the decision step.
      The Site Request Workflow Partial Complete
Review

In this step, you added and configured a Task step. The task Recipient decides to approve or reject the new site request. You configured the step to use the display form so that the recipient cannot make any changes to the request details. You personalized the task notification email by adding references from the Context Browser. Finally, you added a Decision step which generates the outcomes based on the actions configured in the task step. In the next step, you complete the workflow steps for the Rejected outcome.

Next Step: 7. Configure the Rejected Outcome