Automation Rule Example 6
Update the Subject of a Task
When a task is created based on a task template, the task gets by default the subject of the task template. To provide more detailed info to the specialist in the inbox console, it is possible to include extra info in the task’s subject field with an automation rule.
In this example the automation rule linked to an implementation task, will retrieve information from (an UI extension defined on) the request that is linked to the workflow and add this info to the subject of the task.
The following sections describe the key parts of such an automation rule.
Trigger
Because the rule needs to be executed after the implementation 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 implementation task is set to ‘Assigned’. It is defined as follows:
status = assigned
2. request
The expression request
is used to look up the first request that is related to the workflow that the implementation task belongs to. We need this request to retrieve the name of the Product. It is defined as follows:
workflow.requests[first]
3. product_name
The expression product_name
is used to identify the name of the product that needs to be registered. It can be found in the UI extension values of the request. UI extension values can be found in the ‘Custom Data’ field of the request. The expression can be defined as follows:
request.custom_fields.name
4. old_subject
The expression old_subject
is used to retrieve the current subject of the actual task. The Expression ‘old_subject’ is a ‘named expression’. A named expression can be easily included in text strings by surrounding them with 2 curly brackets. This technique will be used to define the new subject.
The expression can be defined as follows:
subject
5. new_subject
The expression new_subject
defines the new Subject for the implementation task, once the implementation task has been assigned. We add the name of the product to the old subject. This can be defined as follows:
'
{{old_subject
}}- Name:
{{product_name
}}'
This expression could also have been defined as follows:
"
{{old_subject
}}- Name:
{{product_name
}}"
or like this:
old_subject <notextile><tt> ' - Name: ' </tt></notextile> product_name
or:
old_subject <notextile><tt> " - Name: " </tt></notextile> product_name
Note that when quotes are placed within a string, they need to be distinguishable from the other quotes. If the texts needs to be:
- Arizona Bachus says: “I like this product!”
this can be done done as follows:
'Arizona Bachus says: "I like this product!"'
or by escaping the double quotes like this:
"Arizona Bachus says: \"I like this product!\""
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 update of the subject of the implementation task. Because the automation rule is defined on the implementation task, the Update field does not require a value. That causes it to default to the current record (i.e. the implementation task).
Set
Because the objective of the action is to update the subject of the implementation task, the following needs to be specified in the Set field:
subject = new_subject
Demo Data
This example can be found in the ‘Information Technology – Widget Europe’ account of the Xurrent demo data. It is included in the implementation task template “Register new Widget product in SAP” of the workflow template ‘Registration of new Widget product in SAP’. To review this example, log into your Xurrent demo instance at Xurrent-demo.com by entering the name and password of the instance. Once you have accessed your instance, select the Xurrent account ‘Information Technology – Widget Europe’. Next, log in as Sandra Huizinga (email address: sandra.huizinga@widget.com
and password: Xurrent
). When you are logged in as Sandra, you can open the workflow template in the Records console.