Return the Badge Configuration Item into Stock
In this exercise you will learn how to unlink a user from a Configuration Item.
The last task in the workflow concerns the retrieval of the parking access badge. You want to set the status of this CI to ‘In Stock’, set the location field to ‘Reception desk’ and unlink the CI from the user (the requester of the parking space).
Create a new Task Template Automation Rule on the ‘Reservation of Parking Space – Retrieve Badge’ task, with the name ‘Return the Badge Configuration Item to Stock’. You know how to write the statements for the following:
- Execute this action when the task gets set to status ‘Completed’
- Get the Request and the Requested For user
This automation rule needs to update the CI that was linked to the previous task. So, you need to retrieve the predecessor task first:
prepare_task |
predecessors[first] |
And next, you can retrieve the parking access badge CI:
badge |
prepare_task.cis[first] |
From the previous exercise you know the actions to update the status and set the location field:
Update | badge |
Set | status = in_stock |
Update | badge |
Set | location = ‘reception desk’ |
Finally, you need to unlink the CI from the user. Removing a record from a collection is done with the ‘Remove’ action. To unlink a user from a CI, issue the following:
Update | badge |
Remove | requester from users |
Your automation rule should look like this:
You can test now the complete flow, from the assignment of the badge until the retrieval of the badge.