Script Master - 12: How to automatically create multiple tasks in a change request with a configurable JSON file.

Script Master - 12: How to automatically create multiple tasks in a change request with a configurable JSON file.


Hello everyone, 


Last week, we learnt how to create multiple child requests from a parent request with a configurable JSON file. This week, you will learn how to automatically create multiple tasks within a change request using an API call, based on the change template chosen. 


Store the details of the tasks in a JSON file and provide the input to the API call. A message with the ID of all the tasks created through the custom trigger is shown in the history section of the request. Refer the comments within the script and the resources section for more information about the JSON structure and tips to update the script. It is available here. 


The configurable JSON file encompasses the name of the change template and the list of tasks to be created. The script matches the template's name received from the change request against the name in the JSON file and creates tasks respectively.


Execution steps: 


1. Copy the script and configuration file into the \Manageengine\ServiceDesk\integration directory.


2. Update the script with the help of the comments provided within.


3. Configure the input JSON file with the help of the detailed explanation in the resources post.


4. Configure the script under Admin  ->  Change Custom Triggers. Provide the path of the JSON file that contains the request configuration as the first parameter to the script. Let the second parameter be the name of the change JSON file.


 I've attached a screenshot showing a sample implementation below.



Note:


1. This script was tested on python v3.4.1 - 32 bit.

2. You can use this script in any version of ServiceDesk Plus above 9113.

3.  A python library called 'Requests' is necessary to run this script on the application server.


To make the best use of this, take a look at the comments within the script and the related post in our resources section.


Trust you found this post useful. In case you've missed the previous posts, visit here. Read through them and post your feedback as comments on the respective posts. See you next week with another useful script.

              New to ADManager Plus?

                New to ADSelfService Plus?