Updating the Configuration file:
The configuration file has the name of the request template of the parent request and the list of child requests to be created. The script matches the template 's name received from the parent request against the name in the JSON file and creates child requests accordingly. The Child request details are stored in the configuration file labeled "ChildRequestsV3.json", in the format shown below.
{
"Request to start the process associated to a new hire": [
{
"request": {
"subject": "Create a VPN Account for the employee $udf_fields,$udf_sline_19 - Parent ID : $id",
"requester": "$requester"
}
}
]
}
The highlighted text is the name of the template,
$udf_fields,$udf_sline_19 additional field values from the parent request
Refer here for more parameters
Example: New hire Template UI is as below
API format after adding the request is as below
Now if you would like to move the User information to the child request just configure the ChildRequestsV3.json like this
{
"New Hire": [
{
"request": {
"subject": "Create a VPN Account for the employee $udf_fields,$udf_sline_19 - Parent ID : $id",
"requester": "$requester",
"description":"Employee Name: $udf_fields,$udf_sline_19 \n Mobile : $udf_fields,$udf_sline_23 \n Department : $udf_fields,$udf_sline_20 \n Seating Location : $udf_fields,$udf_sline_21 \n Joining Date : $udf_fields,$udf_date_901,$display_value"
}
}
]
}
For example, if you want to populate employee name to the child request subject just add $udf_fields,$udf_sline_19 this will replace with exact value from the parent request when child request is created
Note: The variable names enclosed within the dollar symbol are those of the fields that are fetched from the parent request.
Execution steps:
1. Download attached zip
2. Move all files to sdp_home/integration/custom_scripts folder
Note: Don't move configuration.json if there is a file with same name exists
3. Edit configuration.json update url and technicianKey
3. Add the template names and child request details in the JSON configuration file labeled ChildRequestsV3.json.
4. Configure the script and its parameter under the Admin -> Custom Menu. The script file to run parameter will be set as shown below.
py MultipleRequestsV3.py ChildRequestsV3.json $COMPLETE_V3_JSON_FILE
I've attached a screenshot showing a sample implementation below.