Create multiple Child Requests - Depending on a Resource Question - Deluge

Create multiple Child Requests - Depending on a Resource Question - Deluge

This is custom function script to automatically trigger the creation of multiple child requests from a parent request based on parent resource question values. 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 in a global function and are consumed within the custom function. 
A separate API  is used to add the request ids of the child requests as notes to the Parent request. This is achieved using Request Custom Triggers and the link here will provide more information on that.


Use Case: When a new Employee is joining in the organisation based on resource question we need to create multiple child requests
For Example
1. Providing Laptop/Desktop based on the parent resource question
2. Providing Additional monitor
3. Providing Deskphone/Extension etc...
For example, here I am considering the New Hire Template with some resources questions and a check box of list of devices required.

Depending on the answers selected we are creating new child requests.

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.


Note:  "New Hire" is the key used to get the request object in the ChildJson Map. The name of the template can be stated inside the object.

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.