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.
- 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
- Properties: Rename the step: Approve Site Request
-
Begin by returning to the Toolbox main menu. Click the Toolbox icon in the breadcrumb bar.
- Expand the Basic node, then drag a Task step onto the canvas, below the Set Folio step.
- Connect the Set Folio step to the Task step.
- 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. - For the ACTIONS, click Add (+). For the first action, enter
Approved
then add a second action,
Rejected. - 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).
- 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.
- On the OPEN TASK screen, select Help me configure it, then click NEXT.
- On the WORKFLOW VIEW screen, confirm the FORM STATE is Create a new State. The new state name should be Workflow Task. Click NEXT.
- On the OPEN TASK RULE ACTION screen, there are no changes. Click NEXT.
- On the AFTER SUBMIT ACTION screen, there are no changes. Click NEXT.
- The final screen is the Summary. Review the settings, then click SAVE AND FINISH. When you see the Success check, click OK.
- 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. - 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. - 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.
- Begin your email customization with the SUBJECT line. Enter the following:
New Site Request: - 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.
- 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]. - From the Context Browser REFERENCES, drag the Title property into the sentence.
- 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.
- 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
- Click the Properties tab. Rename the step to
Approve Site Request
then collapse the Configuration Panel. - 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 Open Task on a Form wizard launches.
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, K2 replaces the variables with "live" data. There are four tabs: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.
Recipients can action a task in one of three ways:The final configuration is to rename this step.
Add a Decision step. The Decision step generates the outcomes (lines) for the Approve Site Request step.
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.