Check if a Badge Configuration Item is Selected
Automation Rules Training Exercise 12

Check if a Badge Configuration Item is Selected

In this exercise you will learn how to check if a Configuration Item was linked to a task. You will also learn how to reopen and reassign a completed task.

Facilities management manages the parking access badges in 4me as configuration items (CIs). The access badges are kept at the reception desk of the different sites. When the badges are at the reception desk, they have a status ‘In Stock’. When a parking access badge is given to an employee, the status is set on ‘In Production’ and the CI is linked to that person. This enables Facilities Management to have a clear view of who has received an access badge. In this and the following exercises, you will automate the CI management process.

For the task ‘Reservation of Parking Space – Prepare a Badge’, the specialist needs to link the access badge CI to the task: the 4me system needs this info for further automation. To make sure the specialist does not forget to link the CI to the task, you will build an automation rule that will check if a CI is linked to the task, when the status is set to completed. If no CI is found, the automation rule needs to reassign the task and set the successor task (to retrieve the badge) that was already started, back to status ‘Registered’ (because it makes no sense to retrieve a badge if it is not clear if a badge has been provided …).

Create a new Task Template Automation Rule on the ‘Reservation of Parking Space – Prepare a Badge’ task with the name ‘Check if a Badge Configuration Item is Linked’. You know how to write the statements for the following:

Next you will check if a CI is linked to the task. There can be more than one CI linked to a task. Like the Approvers on an approver task, the CI’s linked to a task are a collection. The CI collection is the cis expression. Each CI in a collection can be retrieved with the expression cis[n] , the first CI with ci[first] or ci[1]. When cis[first] is empty, you know no CI is linked to the task. To check if an expression is empty, you can compare with the predefined expression nil or null. This is represented as:

no_ci_selected cis[first] = nil

And for the rules’ condition

condition is_completed and no_ci_selected

You know how to retrieve the successor of this task (that needs to be set to the status ‘Registered’):

retrieve_task successors[first]

What is left are the actions: set the status of the current task to ‘Assigned’ and the status of the successor task to ‘Registered’. You will also add a note to each task, so the team members understand why the status of the tasks were modified:

Update current record
Set status = assigned
Update current record
Add note No Configuration Item found: you need to link the Badge Configuration Item to this task!
Update retrieve_task
Set status = registered
Update retrieve_task
Add note Reset this task to status registered: no badge was selected during the badge reservation.

Your automation rule should look like this:

Exercise 12

Test this automation rule: complete the ‘Prepare a Badge’ task without linking a CI and check what happens.

Next Exercise