Assign to Local Team based on Site
Automation Rules Training Exercise 11

Assign to Local Team based on Site

In this exercise you will learn how to reassign a task to a team based on conditions. You will learn how to define an ‘if … then … else’ statement to set the right team.

The ‘Reservation of Parking Space’ workflow template consists of 2 tasks related to access badge management: the ‘Prepare a badge’ and ‘Retrieve badge’ tasks. These task templates are assigned to the ‘Facilities team’ in New York. But for the other sites, this is done by the local (Boston, Chicago, Houston) Facilities teams. This automation rule will reassign the tasks to the correct team.

Questions:

You will use a Workflow Template Automation Rule, because the 2 conditions are true

# You need to manage other tasks in the same workflow workflow;
# The automation rule will only be used in this workflow

On the Automation task, when the Automation task gets assigned.

Create a new Workflow Template Automation Rule on the ‘Automation’ task with the name ‘Assign to Local Team based on Site’. You know how to write the statements for the following:

Check the site and make 4 (‘true’ / ‘false’) expressions to indicate the site (obviously, only 1 of the expressions will be ‘true):

is_newyork site_name contains ‘Headquarters’
is_boston site_name contains ‘Research’
is_chicago site_name contains ‘Manufacturing’
is_houston site_name contains ‘Data Center’

Now you can set the condition: when the task is approved and when the site is not New York (the tasks are already assigned to the ‘Facilities – New York’ team, in which case you don’t need an action). Use the operator not:

condition is_assigned and not is_newyork

Next step is to identify the correct team. This requires If … then … else statements. This is done by a ternary operator C then A else B that takes three arguments A, B and C. The first argument C is a comparison argument, the second argument A is the result upon C being true, and the third argument B is the result if C is false.

The ternary operator can also be written as C ? A :  B.

Use the following to set the new_team expression to the Boston team if the site is Boston, otherwise set new_team to the Chicago team:

new_team is_boston then ‘Facilities - Boston’ else ‘Facilities – Chicago’

We still need to check if the site is Houston or not. If it is not Houston, it must be Boston or Chigaco (new_team has been set correct in the previous statement) or New York (doesn’t matter, then this automation rule is not executed):

new_team is_houston then ‘Facilities - Houston’ else new_team

Next you retrieve the 2 tasks to be updated:

badge_task1 workflow.tasks[‘Reservation of Parking Space - Prepare a Badge’]
badge_task2 workflow.tasks[‘Reservation of Parking Space - Retrieve Badge’]

Now you can define the 2 actions to set the correct teams:

Update badge_task1
Set team = new_team
Update badge_task2
Set team = new_team

Your automation rule should look like this:

Exercise 11

Next Exercise