4me Help
Automation Rule Example 2

Automation Rule Example 2

Add Information from a Request’s UI Extension to a Task

When a workflow is opened for a request with a UI extension, the field values of this UI extension may need to be used by the specialist to whom one of the tasks of the workflow will be assigned. In such cases, it can help the specialist if this information is already available as a note in the task. That way, the specialist does not need to look for it in the request.

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

Trigger

Because the rule needs to be executed when the workflow is planned, it will probably be included in one of the risk & impact analysis tasks. As soon as the status of this task has been set to ‘Assigned’, the rule can update the implementation task that will get assigned to the specialist when the risk & impact analysis task is completed. The option ‘On status update’ is therefore selected in the Trigger field.
 

Expressions

Assuming that an email address is supposed to be specified in the UI extension of the request, 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. email_address

The expression email_address is added to obtain the email address that is specified in one of the UI extension fields of the first request of the workflow. The field values of a UI extension are stored in the custom_data field. If we assume that the UI extension field that contains the email address has the field identifier email_address, the expression is defined as follows:

  • workflow.requests[first].custom_data.email_address

3. register_task

The expression register_task is used to identify the task that will later be assigned to a specialist who needs the email address to register it in Active Directory (AD). If the subject of this task is ‘Register new employee in AD and create new email account’, the expression is defined as follows:

  • workflow.tasks['Register new employee in AD and create new email account']
     

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’ and the UI extension of the request needs to contain a value in its email_address field. There are already two expressions that can be used for this, so the condition that needs to be met is simply:

  • is_assigned and email_address
     

Update

The record that needs to be updated is the task that will later be assigned to the specialist who needs to email address. Again, there is already an expression for this. That is the expression register_task. This expression can therefore be selected in the Update field.
 

Add note

Because the objective is to add a Note to the task for the specialist, the default option ‘Set’ needs to be updated to ‘Add note’. That provides a rich text field in which the note for the task can be defined. The email_address expression of the rule can be used in this note as follows:
 

The requested email address is: {{email_address}}

 

Demo Data

This example can be found in the ‘Information Technology – Widget North America’ account of the 4me demo data. It is included in the risk & impact analysis task template of the workflow template ‘Prepare services for new employee’. 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 North America’. Next, log in as Karri Otter (email address: karri.otter@widget.com and password: 4me). When you are logged in as Karri, you can open the workflow template in the Records console.