Create multiple Child Requests - Deluge Script

Create multiple Child Requests - Deluge Script

This is a sample deluge script to automatically trigger the creation of multiple child requests from a parent request, based on the request template chosen. The request ID of the child requests will be added as a Note in the parent request.

This is achieved using an API call to create a request in ServiceDesk Plus. Details of the child requests are stored as a JSON in Global Function and is then consumed within the script. The parent request details are passed as a JSON object to the custom function. 


Use Case: 
When certain Services are requests by a user, under the service category 'User Management', multiple child requests have to be triggered.
In the sample shown below, two-child requests will be triggered when a Service Request is created using the template 'Employee Termination'.

Steps to configure:
1.  Download and extract the zip file contents.

2.  Goto Admin > Request Custom Function > Global Function > New > Paste the contents of global_function_14_childJson.txt and save it with a name.  Update the parent template name and the UDF fields.



3.  Update the global function numbers in the custom function as per your build installation.

4.  Goto Admin > Request Custom Function > Global Function > New > Paste the contents of global_function_4 - Configuration.txt  Update the build URL and Technician Key.



5.  Goto Admin > Request Custom Function > Global Function > New > Paste the contents of global_function_15_addAttachment.txt and save it with a name.



6.  Goto Admin > Request Custom Function > Global Function > New > Paste the contents of global_function_11_findAllDynamicKeysMultiLevel.txt and save it with a name.



7.  Goto Admin > Request Custom Function > Global Function > New > Paste the contents of global_function_7_createChildRequest.txt and save it with a name.



8.  Goto Admin > Request Custom Function > Global Function > New > Paste the contents of global_function_12_getDynamicFieldValue.txt and save it with a name.



9.  Goto Admin > Request Custom Function > Global Function > New > Paste the contents of global_function_16_createChildJson.txt and save it with a name.  



10.  Goto Admin > Request Custom Function > New Custom Function > Paste the contents of custom_function_MultipleRequestsV3.txt  


11.  Configure the custom trigger to invoke this custom function when a ticket is created.
12.  Child request ids will be added as a note to the parent request.