In Part 3 of this tutorial, we will edit our Leave Request Workflow by expanding the system tasks and by adding an additional Manager Approval outcome. We will learn about escalations and how they can be used to remind a user of a task waiting to be actioned. We will also be tweaking the Forms in the application to behave differently depending on where in the workflow the form is being used.
In this part, you will learn:
(If you have not completed Part 2 of this tutorial yet, please do so before continuing with this part)
In Step 5, we will replace the two Placeholders with email events that notify the originator with the manager's decision.
Your email should look like the image below. Click OK when ready.
In this step, we added an email event and customized the email using properties found in the Context Browser. The placeholder values from the Context Browser (indicated by green blocks in the wizard screens) will be replaced at runtime by K2 with the actual values for that instance of the workflow. The Workflow Context offers properties that contains details about the workflow itself, such as the workflow Originator, Originator's email, Manager, Folio and so on. Item References contain SmartObject field references. For example, the [Leave Request Title] Item Reference is replaced at runtime with whatever value was entered into the form's Leave Request Title field. This allows you to customize and personalize your workflow. We also demonstrated the ease of reusing content by copying and pasting events.
In this step, we are going to add an additional outcome for the Manager Approval task. This third outcome, called Rework, will send the request back to the originator where it can either be resubmitted or canceled. We will add a new User Task for the form originator to action the Rework task, then add events to complete the Rework decision outcomes.
For this step, we will add text to the notification email and customize the Subject line. For the Subject line, enter
Leave Request Submitted: [Leave Request Title]
then drag the Item References > Leave Request SmartObject > Leave Request Title to the end of the subject line. (See the image below as a reference if necessary.)
In the message body, just below the Dear Participant line, enter the following, dragging values from the Context Browser as needed for the field marked in brackets.
A Leave Request has been submitted and now requires a decision by you. Please review the following details, then reply to this email with one of the decision actions as the email body.
Employee Name: [Employee Name]
Leave Start Date: [Leave Start Date]
Leave End Date: [Leave End Date]
Leave Type: [Leave Type]
(Click Finish when ready.)
Notice that K2 has added the third action outcome with an event box.
Now we want to configure the events for the two Rework outcomes (Resubmitted and Canceled). First, we will route the Resubmitted outcome back to the Set Status Submitted event so that the workflow returns to a previous step in the workflow. For the Canceled outcome, we will copy and paste a Set Status event, then update the Request Status value so that it indicates Canceled.
Notice now that K2 routes the Resubmitted outcome back to the Set Status Submitted event. This will create a loop effect in the workflow between the Rework and Resubmitted outcomes until a different action is selected.
We are removing this outcome because we don't need to continue the workflow after this step. If the decision is to cancel the request, then after the Request Status property has been updated, the workflow will be complete.
In this step we added a third action for the Manager Approval task. We customized the task notification email so that the manager can use SmartActions to action the task directly from the email. We added a User Task for the form originator in the event the manager decides the request needs to be reworked. We routed the Resubmitted outcome so that the workflow essentially starts over again if the originator resubmits the request, or the status of the request is set to Canceled if the originator decides to cancel the request.
In this step, we will explore escalations and how you can use them to keep your workflows running. An escalation kicks in when a user has not responded to a task assigned to them within the specified time period. An escalation can be a simple email to the task-assigned user, reminding them they have a task waiting. An escalation can be also more complex, like automatically redirecting the workflow to another user if the task is still waiting, repeating the escalation a number of times or multiple escalations on the same step to do different things depending on the elapsed time.
One word of caution: you don't want to crowd users' in-boxes with reminder notices, so take care in which events you apply escalations to and give some thought as to who you are reminding. For example, it might be a better choice to send the escalation notice to the originator so that they can follow up with their manager, or limit the number of escalations to only what is really necessary.
In this step, we will apply an escalation to the Manager Approval User Task that will send a reminder email to both the manager and the originator if the manager has not responded within two days of the Leave Start Date.
There are three options for escalations. The most common perhaps, is Email, where an email reminder is sent to the destination user (and optionally, the form originator) letting them know they have an outstanding task. You can choose to Redirect the task to another user or Expire the task, which essentially marks the task 'complete' and moves the workflow on to the next step.
Here, we are simply telling K2 that we want to kick off this escalation two days prior to the Leave Start Date.
Click Finish when you are done to complete the Escalation wizard screen.
In this step, we added an escalation to send an email reminder two days prior to the Leave Start Date in the event the manager has not actioned the request yet. We customized our email to include details about the specific request, and we configured the email to route to the manager and the form originator.
Before the workflow changes will be applied, we must deploy the workflow to the K2 server.
Now that the workflow changes have been published, we need to make a couple of tweaks to the Forms used by the workflow, because we want the Forms to behave differently depending on the current task. Recall in a previous step we added the Approver Comments field to the Leave Request Item View. We made the field read-only by default, as the form originator will not need to use this field for comments. In this step, we will edit the Form Initializing rule for the Workflow Task state for the Manager Approval task, and enable the Comments field.
In Step 9, we edited the Workflow Task state, Form Initializing rule and enabled the Approver Comments field for the Manager Approval task. This will allow the approving manager to add comments to the request if they choose. This step demonstrated the power of states and how you can edit individual states to customize the user interface for a specific task or event.
Now we will add a new rule to this state. This rule will allow us to save any changes the manager or originator might have made to the form, such as adding Approver Comments.
IMPORTANT: Be sure to complete this step. We want to use the SmartObject ID so that K2 knows we are updating the current record. If we use the auto-mapped ID, K2 would not recognize the value as the current record.
Click Finish. Click OK to close the Rule Designer.
In this step, we added a rule that will fire off the Save method (which is the equivalent of update) for the Leave Request SmartObject with any changes the user might have made.
The last few edits we are going to make to the rules will be to clear the form entries after the form originator has clicked the Create button, then add the new entry to the List View. Recall in the Basic application, when the form originator submitted the form there wasn't any visual indication of the form being submitted. By clearing the form entries and updating the List View, the user will have visual confirmation that their request was submitted.
Now we will update the Leave Request List View so that the new entry is shown.
We have one additional step we need before we close out of our form. In the previous step, we cleared the form entries when the user clicked the Create button. Now we need to add back in the Employee Name and Employee Email values so the refreshed form appears exactly the same as a brand new form.
In this final step of configuring actions, we added a clear method so that the user will have a visual confirmation that their form was submitted. There are a number of mechanisms for letting your users know they have successfully submitted a form, including adding a confirmation pop-up message or redirecting them to a web page, for example. As you build more applications within your own environment, you will gain knowledge of what works best for your target users.
Now that our application changes are done, we will move on to Part 4 and test the new version of the Leave Request Approval application
Video | Links | Learn | Support |
No videos found for this article K2 on YouTube
No Additional links found for this article
No self-learning content for this article Try some scenarios...
No relevant support links available for this article
|