Xurrent Help

Automation Rule Example 8

Assign Task to Correct Team Using an if-then-else Statement

For a ‘Move Desktop PC’ request, the coordinator of the team ‘End-user Support, New York’ must reassign the tasks assigned to his team, to the ‘End-user Support, Chicago’ team when the requester belongs to the Manufacturing organization or to the ‘End-user Support, Boston’ team when the requester belongs to the Research & Development Center. An automation rule can be used to reassign these task.

The following sections describe how the workflow manager can define the key parts of this automation rule.
 

Trigger

Because the rule needs to be executed when the workflow and the tasks are created, the option ‘On create’ 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. request

The expression request is used to look up the first request that is related to the workflow that the approval task belongs to. We need this request to retrieve the organization of the Requester (this could be written in 1 expression, the advantage of writing it in 3 expressions is that all 3 values will be logged during rule execution which gives better insight). It is defined as follows:

  • workflow.requests[first]

2. requester

The expression requester is used to get the ‘Requested for’ user. This expression is defined as follows:

  • request.requested_for

3. organization

The expression organization is used to get the organization of the ‘Requested for’ user. This expression is defined as follows:

  • requester.organization

4. old_team_name

The expression old_team_name is used to identify the actual team assignment of the task. This expression is defined as follows:

  • team.name

5. is_from_manuf

The expression is_from_manuf is used to check if the requester belongs to the Manufacturing organization. This can be defined as follows:

  • organization contains 'Manufacturing'

6. new_team_name

The expression new_team_name is used to set a new team assignment if the requester belongs to the Manufacturing organization. This is done by a ternary operator C <strong>then</strong> A <strong>else</strong> B that takes three arguments A, B and C. The first argument A is a comparison argument, the second argument B is the result upon a true comparison, and the third argument C is the result upon a false comparison. This expression is defined as follows:

  • is_from_manuf then 'End-User support, Chicago' else old_team_name

7. is_from_rd_center

The expression is_from_rd_center is used to check if the requester belongs to the Research & Development center. This can be defined as follows:

  • organization contains 'Research & Development'

8. new_team_name

The expression new_team_name is used to set a new team assignment if the requester belongs to the Research and Development organization. This expression is defined as follows:

  • is_from_rd_center then 'End-User support, Boston' else new_team_name

9. move_task

The expression move_task is used to identify the task for for the move of the desktop PC. Because the subject of this task is ‘Move desktop PC to new location’, the expression can be defined as follows:

  • workflow.tasks['Move desktop PC to new location']

9. update_cmdb

The expression update_cmdb is used to identify the task for for the move of the desktop PC. Because the subject of this task is ‘Specify new location in CI record of PC’, the expression can be defined as follows:

  • workflow.tasks['Specify new location in CI record of PC']

 

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 rule must be executed when the requester belongs to the Manufacturing or Research & Development organisation. This is simply:

  • is_from_manuf or is_from_rd_center

 

Update 1 Set the assignment team of the task ‘Confirm availability of the LAN connectivity’

The rule needs to update the task ‘Confirm availability of the LAN connectivity’. Since this is the task for which the automation rule is defined, the Update field does not need to have a value. That will cause it to default value to the current record.
 

Set

Because the objective of the rule is to update the assignment team of the current task, the following needs to be specified in the Set field:

  • team = new_team_name
     

Update 2 Set the assignment team of the task ‘Move desktop PC to new location’

The expression move_task has been set to identify this task. This expression can therefore be selected in the Update field.
 

Set

Because the objective of the rule is to update the assignment team of the current task , the following needs to be specified in the Set field:

  • team = new_team_name

Update 3 Set the assignment team of the task ‘Specify new location in CI record of PC’

The expression update_cmdb has been set to identify this task. This expression can therefore be selected in the Update field.

Update 4 Empty assignment member of the task ‘Confirm availability of the LAN connectivity’

The rule needs to update the task ‘Confirm availability of the LAN connectivity’. Since this is the task for which the automation rule is defined, the Update field does not need to have a value. That will cause it to default value to the current record.

Set

Because the automation rule will fail if a specialist not belonging to the new team is selected in the member field of the task, the following needs to be specified in the Set field:

  • member = empty

Update 5 Empty assignment member of the task ‘Move desktop PC to new location’

The expression move_task has been set to identify this task. This expression can therefore be selected in the Update field.
 

Set

Because the automation rule will fail if a specialist not belonging to the new team is selected in the member field of the task, the following needs to be specified in the Set field:

  • member = empty

Update 6 Empty assignment member of the task ‘Specify new location in CI record of PC’

The expression update_cmdb has been set to identify this task. This expression can therefore be selected in the Update field.
 

Set

Because the automation rule will fail if a specialist not belonging to the new team is selected in the member field of the task, the following needs to be specified in the Set field:

  • member = empty
     

Demo Data

This example can be found in the ‘Information Technology – Widget North America’ account of the Xurrent demo data. It is included in the workflow template ‘Move desktop personal computer’. 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 North America’. Next, log in as Karri Otter (email address: karri.otter@widget.com and password: Xurrent). When you are logged in as Karri, you can open the workflow template in the Records console.