How to automatically assign users to different roles in a change request.

How to automatically assign users to different roles in a change request.

This script is applicable only for builds prior to 11138.

This is a sample python script to read the value in the Change Owner field, when a Change Request is created and set him/her as the Change Implementer automatically, using Change Custom Triggers.

This is achieved by submitting an update request to the application in a specific JSON format, an example of which is given below.

{"operations": [{"input_data": {"change": {"roles": [{"users": [{"name": "Hugo.Weaving", "email": "Agent.Smith@Matrix.WB"}], "name":
"Implementer"}]}}, "operation_name": "UPDATE_ROLES"}], "message": "Updating Change Roles through Custom Trigger"}

You can find more information about this feature in the link here. All Change Roles can be set/updated using this feature. The details of the Change Request are provided as input to the script, in JSON format. More information on Change Custom Triggers can be found at this link.

To update roles, this script uses the V1 API format.  Please use this in builds prior to the V3 API release, i.e. builds prior to 11138.

User Case:
Change managers often decide who plays different roles in implementing the change effectively in an IT infrastructure. For a frequently carried out change request, the team involved may be the same. This can be based on the services affected or the change type. As a result, the change manager has to repeatedly assign the same set of technicians for a frequently occurring RFC. This script will help you do away with repetitive technician assignments and automate the process of adding users to different change roles by using custom triggers.

A simple guide on setting up python on the server is available here.

Execution steps: 
1. Copy the script file into the \Manageengine\ServiceDesk\integration directory. 

2. Update the script with the name of the role along with the name and email address of the users. Make sure you follow the syntax provided in the comments section to make necessary changes. 

3. Configure the script under the Admin --> Change custom triggers. Provide the path of the request json file as the input to the script. 

Below is a screenshot showing a sample configuration.