Automation Rules: Example 6
Transfer of the approval task to the approving person's manager
The workflow cannot be continued if the matching person has not agreed on the corresponding matching task. If the coordinator has not agreed on the task, the workflow manager can decide to escalate by reassigning the approval task to the coordinator's manager. This example shows how to do this using the automation rule.
In this case, automation consists of two rules. The first rule reassigns the approval task to the approving person's manager, it is triggered by the trigger ‘After delays’. The second rule determines which period is considered a delay. After a delay of 2 days, the first rule is triggered.
The main elements of such an automation rule are described below.
Escalation of coordination
Trigger
The rule must be executed with a delay of 2 days, respectively, the option ‘After delay’ is selected in the "Trigger" field.
Expressions
The following expressions are set for the rule. In the future, they are used to determine the condition of the rule and the actions performed by it:
1. is_assigned
The expression is_assigned defines that the value of the "Status" field of the approval task is still
‘Assigned' (if the status has changed to ‘Rejected’ or ‘Agreed’, then escalation is not required). The expression is defined as follows:
status = assigned
2. approval
The expression approval is added to get information about approval. A
matching task may have several matching persons.
A matching record is defined for each matching. Since there is only one matching agent in the matching task under consideration,
information about it must be obtained from the first matching record. The expression is defined
as follows:
approvals[first]
3. approver
The expression approve is necessary to search
for the approving person's manager. To find a match, use the matching record obtained by
in the previous expression. The approval record consists of the name of the approving party and
the approval status. This expression finds the name of the matching one and is defined
as follows:
approver.manager
4. request
The request expression is used to search for the first request related to
the workflow to which the approval task belongs. This request is needed to
get the product name specified in the request and the initiator's name. The expression is defined
as follows:
workflow.requests[first]
5. product
The expression product is used to determine the name of the product for which
approval is required. It can be found in the request in the values of the UI extension.
In turn, these values are located in the user's request field. The expression is defined
as follows:
request.custom_fields.name
6. requester
The expression `requester' is used to search for the name of the person for whom the workflow is being implemented. It is defined as follows:
request.requested_for.name
7. manager
The expression manager is used to search for the matching person's manager. The matching one itself has already been found through the previous expression, then its manager can be defined as follows:
approver.manager
8. escalated
The escalated expression checks whether an escalation has already been performed for the reconciliation task. For example, an escalated approval task could be rejected, and
The workflow manager has updated its status to ‘Assigned' to request approval again. The automation rule adds the prefix “Escalation:” to the topic of the approval task, so that the task is not reassigned to the head of the manager of the original approving person. The expression checks whether the topic begins with the word
“Escalation.” If so, the expression ‘escalated' will be true.
There is a ‘starts_with’ operator for this check, which is defined as follows:
subject starts_with 'Escalation:'
9. subject
The expression subject finds the topic of the matching task. It is defined
as follows:
subject
10. escalated_subject
The expression escalated_subject sets a new topic for the negotiation task when it escalates. For this, the prefix “Escalation" is added.:”. The expression is defined
as follows:
- ‘Escalation: {{
subject}}’
Update 1
An action performed by a rule is an addition to a task. approving a comment that notifies the approving person's manager that the task has been reassigned to him (the manager). Since the automation rule is defined for the current approval task, the "Update" field does not need to be filled in. In this case, the default value is assigned to the current record (i.e. the reconciliation task).
Add a comment
Required action is ‘Add comment'. When adding this action, a text field appears in which the text of the comment is entered. The variables in the comment (the names of the requester, his manager and initiator; the name of the product) are already defined in expressions. They are added to the text using two curly brackets. A comment is defined as follows:
Dear {{manager}},{{requester}} waiting 2 days for approval from{{approver}}
to register the product {{product}} in 1C.
Update 2
The second action of the rule changes the approving person to his manager. The matching record has already been defined in the expression. Therefore, the value of the "Matching" field of the matching record must be set to the manager of the original matching person. To do this, specify the following in the "Set" field:
approver = manager
Update 3
The third step updates the topic of the approval task by adding a text (prefix) to it. Since the automation rule is defined for the approval task, the "Update" field does not need to be filled in. In this case, the default value is assigned to the current record (i.e. the matching task).
Ask
The new topic prefix was defined in the expression escalated_subject. Therefore, the following is indicated in the "Set" field:
subject = escalated_subject
Schedule the escalation of the reconciliation task in 2 days
Trigger
The rule "Escalation of the approval task" must be executed 2 days after the assignment of the task to the approving person. This means that the value ‘After status update’ is selected in the "Trigger" field.
Expressions
The following expression is set for the rule. In the future, it is used to define the rule condition.:
1. is_assigned
The expression is_assigned defines that the value of the "Status" field of the approval task is still
‘Assigned' (if the status has changed to ‘Rejected’ or ‘Agreed’, then escalation is not required). The expression is defined
as follows:
status = assigned
Condition
After defining the expression, the rule is given a condition under which this rule is fulfilled. In this example, the task status should be be ‘Assigned'. Since there is already an expression for this, the true condition looks like this:
is_assigned
That's all you need to enter in the "Condition" field for the rule.