Rules for Automation: Example 2
Adding information from a UI extension to the task
When opening a workflow for a task with a UI extension, the values of these UI extension fields can be useful to a specialist assigned to one of the workflow tasks. It’s convenient if this information already exists in the task's comment, so the specialist doesn’t have to search for it within the request itself.
Below are the main elements of this automation rule.
Trigger
Since the rule should run when a workflow is scheduled, it will likely be included in one of the risk and impact analysis tasks. Once the status of this task changes to ‘Assigned’, the implementation task associated with the specialist will be updated after the risk and impact analysis task is completed. Therefore, the “Trigger” field selects the option ‘On Status Change’.
Expressions
Let's assume that an email address needs to be specified in the UI extension of a request. The following expressions are defined for the rule, and will be used later to determine the condition of the rule and the actions it performs:
1. is_assigned
The expression is_assigned indicates that the “Status” field of the alignment task has a value of ‘Assigned’. This is defined as:
status = assigned
2. email_address
The expression email_address is added to retrieve the email address specified in one of the fields of the first request workflow. The values from UI extension fields are stored in custom fields. If a UI extension field containing an email address has an identifier of email_address, the expression is defined as:
workflow.requests[first].custom_fields.email_address
3. register_task
The expression register_task is used to identify the task that will subsequently be assigned to a specialist who needs an email address for registration in Active Directory (AD). If the task’s subject is ‘Register a new employee in AD and create a new email account’, the expression is defined as:
workflow.tasks['Register a new employee in AD and create a new email account']
Condition
After defining the expressions, conditions are set for the rule, specifying when this rule should run. In this example, the task status needs to be ‘Assigned’, and the UI extension of the request should contain a value in the email_address field. Since we already have two expressions for this, the true condition looks like:
is_assigned and email_address
Update
The item to update is the task that will subsequently be assigned to a specialist who needs an email address. We already have an expression - register_task, so this expression is selected in the "Update" field.
Add Comment
Since we need to add a comment to the task for the specialist, we should change the default option ‘Set’ to ‘Add Comment’, which will create a Rich Text field where we can define the comment for the task. The email_address expression from the rule can be used in this comment as follows:
Requested email address:{{email_address}}