4me Help

Automation Rule Example 5

Remind Approver After Delay

When an approval task is assigned, the workflow does not continue until the approver approves. If the approver forgets, the manager of the workflow can decide to send a reminder to the approver. In this example the workflow manager wants to use the automation rules to send out a reminder to the approver after 1 day, provided that the status for the approver is still ‘Assigned’.

The automation consists of 2 parts. The first automation rule sends the reminder to the approver. This automation rule is started by an ‘After delay’ trigger. The delay is defined in the second automation rule. After a delay of 1 day it starts the first rule.

The following sections describe how the workflow manager can define the key parts of these automation rules.
 

Approval Reminder

Trigger

Because the rule needs to be executed after a delay of 1 day, the option ‘After delay’ is selected in the Trigger field.
 

Expressions

The following expressions are defined for the rule so that they can subsequently be used to define the condition for the rule, as well as the actions that it needs to execute:

1. is_assigned
The expression is_assigned specifies that the Status field of the approval task is still ‘Assigned’ (if the status is ‘Rejected’ or ‘Approved’ there is no need to send a reminder). It is defined as follows:

  • status = assigned

2. approver

The expression approver is added to look up the approver of the approval task. An approval task can have multiple approvers. For each approver an approval record is defined. The approval record consists of the name of the approver and the approval’s status. As this approval task has only 1 approver, the approver is to be retrieved from the first approval record of found the approval task. This expression is defined as follows:

  • approvals[first].approver

3. request

The expression request is used to look up the first request that is related to the workflow that the approval task belongs to. We need this request to retrieve the name of the product name that is specified in the request, as well as the name of the requester. It is defined as follows:

  • workflow.requests[first]

4. product

The expression product is used to identify the name of the product for which an approval is required. It can be found in the UI extension values of the request. UI extension values can be found in the custom_fields field of the request. The expression can be defined as follows:

  • request.custom_fields.name

4. requester

The expression requester looks up the name of the person for whom the workflow is to be implemented. It can be defined as follows:

  • request.requested_for.name

 

Condition

After the expressions have been defined in the rule, the condition, which needs to be met in order for the rule to be executed, can be set. In this example, the status of the task needs to be ‘Assigned’. Since there is already an expression for this, the condition that needs to be true is simply:

  • is_assigned

That is all that needs to be entered in the Condition field of the rule.
 

Update

The action that needs to be executed by the rule is the addition of a note in the approval task to inform the approver that the task is still awaiting his/her approval. Because the automation rule is defined on the approval task, the Update field does not require a value. That causes it to default to the current record (i.e. the approval task).
 

Add note

The required action is ‘Add note’. That provides a rich text field in which the note can be defined. The variables in the note (the name of the approver, the name of the requester and the name of the product) are already defined in an expression. The expressions are embedded in the rich text surrounded by 2 curly brackets. The note can defined as follows:
 

Dear {{approver}}, {{requester}} is waiting on your approval for the registration of the {{product}} product in SAP.

 

Schedule Approval Reminder After 1 Day

Trigger

Because the Approval Reminder rule needs to be executed 1 day after the approver task has been assigned to the approver, the option ‘On status update’ is selected in the Trigger field.
 

Expressions

The following expression is defined for the rule so that it can subsequently be used to define the condition for the rule:

1. is_assigned
The expression is_assigned specifies that the Status field of the approval task is set to ‘Assigned’. It is defined as follows:

  • status = assigned

 

Condition

After the expression has been defined in the rule, the condition, which needs to be met in order for the rule to be executed, can be set. In this example, the status of the task needs to be ‘Assigned’. Since there is already an expression for this, the condition that needs to be true is simply:

  • is_assigned

That is all that needs to be entered in the Condition field of the rule.
 

Delay execution

The action that needs to be executed by the rule is a delayed action. A delayed action consists of two parts. First the duration of the delay is defined in the After field. Next, the rule that needs to be started after the delay is selected in the Start field.
 

After

The delay duration must be defined. This can be done in seconds, minutes, hours, days, months or years. In this example the 1-day delay duration is defined as follows:

1.day

This expression could also have been defined as follows:

24.hours

or
1440.minutes

or
86400.seconds

If a date and/or time had been retrieved by an expression, it can be used to perform calculations. For example, if the desired completion target of the approval had been defined in the expression completion_target, it would be possible to define the moment that is 1 hour before the task’s completion target with this expression:

completion_target - 1.hour

This expression could then be specified in the After field.

Start

Select an automation rule which Trigger field is set to ‘After delay’. In this example the ‘Approval Reminder’ rule is selected as follows:

Approval Reminder

 

Demo Data

This example can be found in the ‘Information Technology – Widget Europe’ account of the 4me demo data. It is included in the approval task template of the workflow template ‘Registration of new Widget product in SAP’. To review this example, log into your 4me demo instance at 4me-demo.com by entering the name and password of the instance. Once you have accessed your instance, select the 4me account ‘Information Technology – Widget Europe’. Next, log in as Sandra Huizinga (email address: sandra.huizinga@widget.com and password: 4me). When you are logged in as Sandra, you can open the workflow template in the Records console.