Rules for Automation: Example 7
Task Theme Update
If a task is created based on a template, the template’s theme is automatically copied into it. Using an automation rule, you can add additional information to the task’s theme so that specialists get more details when the task appears in the “Inbound” console.
In this example, the automation rule is linked to a specific task implementation. It retrieves information from a request defined by a UI extension and associated with the workflow. This information is added to the task’s theme.
Below are the main elements of such an automation rule:
Trigger
The rule should execute after the task status is changed to ‘Assigned’. Therefore, select “On Status Change” in the "Trigger" field.
Expressions
The following expressions are defined for the rule. They will be used later to define the condition and actions performed by the rule:
1. is_assigned
The expression is_assigned indicates that the “Status” field of the task has the value ‘Assigned’. It is defined as follows:
status = assigned
2. request
The expression request is used to find the first request associated with the workflow to which the task belongs. This request is needed to retrieve the product name. The expression is defined as follows:
workflow.requests[first]
3. product_name
The expression product_name is used to retrieve the product name that needs to be registered. It can be found in the request, within the values defined by a UI extension. These values are located in the user field of the request. The expression is defined as follows:
request.custom_fields.name
4. old_subject
The expression old_subject is used to retrieve the current task subject. This expression is named. Named expressions can be included in text using curly braces. This method will be used to define the new subject.
The expression is defined as follows:
subject
5. new_subject
The expression new_subject defines the new task subject after it has been assigned. We add the product name to the old subject. The expression is defined as follows:
'{{old_subject}}- Имя:{{product_name}}'
The expression can also be defined as:
"{{old_subject}}- Имя:{{product_name}}"
or as:
old_subject+' - Имя: '+product_name
or:
old_subject+" - Имя: "+product_name
Note: The quotes must differ between themselves. If the text should be like this:
- Денис Скворцов говорит: “Мне нравится этот продукт!”
then you should use quotes like this:
'Денис Скворцов говорит: "Мне нравится этот продукт!"'
or you can escape the quotes like this:
"Денис Скворцов говорит: \"Мне нравится этот продукт!\""
Condition
After defining the expressions, you need to set a condition under which the automation rule will execute. In this example, the task status should be ‘Assigned’. Since a suitable expression already exists, the actual condition is:
is_assigned
That’s all you need to enter in the "Condition" field for the rule.
Update
The action performed by the rule is to update the task’s theme. Since this automation rule has been defined for the current task implementation, you do not need to fill in the "Update" field. In this case, the default value is assigned to the current record (i.e., the task implementation).
Set
The purpose of the action is to update the task’s theme, so you specify in the "Set" field:
subject = new_subject