This is a sample Python script to automatically create multiple tasks within a change request with a configurable JSON file.
This is achieved using an API call to create a task in ServiceDesk Plus . Details of the tasks are stored in a json file and provided as the primary parameter to the script. The change request details are stored as a JSON object in a file and its path is provided as second parameter. This is achieved using Change Custom Triggers and the document available here
will provide more information on that.
Updating the Configuration file:
The configuration file has the name of the change template and the list of tasks to be created under it. The script matches the template 's name received from the change request against the name in the JSON file and creates tasks accordingly.The task details are stored in the configuration file labeled "ChangeMultipleTasks.json", in the format shown below.
"title": "BackUp existing tapes",
"description": "BackUp existing tapes",
"name": "Database Hardware"
The highlighted text is the name of the template and the rest is the details of the task to be created under it through change custom triggers.When a Change is raised using the template "Storage Growth" , the task will be created under the implementation stage automatically.
1. Copy the attached script file and the configuration file into the \Manageengine\ServiceDesk\integration directory.
2. Update the protocol, servername and portnumber use to access ServiceDesk in the script file labeled ChangeMultipleTasks.py.
3. Add the template names and task details in the json configuration file labeled ChangeMultipleTasks.json.
4. Configure the script and its parameter under the Admin -> Custom Triggers.The script file to run parameter will be set as shown below.
py ChangeMultipleTasks.py ChangeMultipleTasks.json $COMPLETE_JSON_FILE
I've attached a screenshot showing a sample implementation below.
A short guide on setting up python is available here