4me Help

Automation Rule Example 1

Add a Note to the Request of a Workflow

To keep a requester informed of the progress of a workflow after this workflow has been opened for a request, it is possible to include automation rules in the tasks of the workflow. An automation rule could, for example, be linked to an approval task to ensure that a note is added to the request when the approval task is set to ‘Assigned’. This note could inform the requester that the requested workflow is awaiting approval.

The following sections describe the key parts of such an automation rule.
 

Trigger

Because the rule needs to be executed after the status of the approval task has been set to ‘Assigned’, the option ‘On status update’ 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 set to ‘Assigned’. It is defined as follows:

  • status = assigned

2. approver

The expression approver is added to obtain the name of the approver to whom the task is assigned. It is defined as follows:

  • approvals[first].approver

This is the person who is linked to the first approval record that is part of the approval task (i.e. the first approver). As long as it is the first approver, this is the same as:

  • member

This is the first person who is linked as an approver to the approval task.

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. It is defined as follows:

  • workflow.requests[first]

This expression could also have been defined as follows:

  • workflow.requests[1]

To look up the second request that is linked to the workflow, the expression is:

  • workflow.requests[2]

The expression for looking up the last request is:

  • workflow.requests[Last]

or

  • workflow.requests[-1]

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:

  • workflow.requests[first].requested_for.name

Another way to define this expression would be to make use of the previous expression that already defined the first request of the workflow:

  • 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 record that need to be updated is the first request that is linked to the workflow to which the approval task belongs. Again, there is already an expression for this. That is the expression request. This expression can therefore be selected in the Update field.
 

Add note

Because the objective is to add a Note to the request, rather than setting one of the request’s fields to a new value, the default option ‘Set’ needs to be updated to ‘Add note’. That provides a rich text field in which the note for the request can be defined. The expressions of the rule can be used in this note as follows:
 

Dear {{requester}},
Your request is awaiting approval from {{approver}}

 

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.