Deluge Script to achieve First Response SLA-Notes Addition

Deluge Script to achieve First Response SLA-Notes Addition

Before following the below steps, ensure that you have the option "Enable First response by default for notes addition" under Admin - > Self Service portal settings. 

1. Go to Developer Space > Custom Function > Request >  Global Functions and click on New. Copy the below content and use the same like mentioned in the following screenshot.

configuration = Map();
configuration.put("url","http://supportsdpmsp:8080");
configuration.put("technicianKey","ABC12E73-C5B8-4B84-81CA-127C627F4778");

return configuration;



  

Save the Global function by following the above step. Make sure to specify the correct application URL and the technician key instead of the ones highlighted above. You can generate a technician key by clicking on Profile icon on top right of the application UI - > Generate API key.  

2. Now, go to Developer Space - Custom Function - Request, and add new custom Action. Add the script content mentioned below as shown in the following screenshot.

"configuration = global_function_6();
helpdeskID = context.get("instance").get("id");
reqId = requestObj.get("id");
descr = "Relative Content can be added here";
inputData = {
    "note": {
        "description": descr,
        "mark_first_response": true
    }
};
response = invokeurl
[
url: configuration.get("url") + "/api/v3/requests/"+reqId+ "/notes"
type: POST
parameters: {"input_data":inputData}
headers: {"authtoken":configuration.get("technicianKey"),"PORTALID":helpdeskID}
];
// info response;
returnObj = Map();
if(response.get("response_status").get("status_code") == 2000){
returnObj.insert("result":"Success","message": "Note is added successfully for the request"+reqId);
}
else{
returnObj.insert("result":"Failure","message":response.get("response_status").get("messages").get(0).get("message"));
}
return returnObj;
"



( i ) Make sure that the Global function variable specified above matches with the one created as highlighted in step 1 and 2 (i.e global_function_6()). 

( ii ) As highlighted in the script above in red, you can add relative content for the note. Example, 'Adding note to mark First response'.  

3. You can now save and test the custom action using any request from the list. Click on Save and test to test the script. You will see a message like below.



4. Now, go to Admin - > Custom triggers, and create a new custom trigger like below. You can set the required criteria in the trigger and select the custom function from the list so that the script gets triggered based on the criteria.



As per the above, requests created with open status will have the script triggered and a note will be added to the request, thus marking first response. 

                  New to ADSelfService Plus?

                    • Related Articles

                    • Deluge Script to achieve First Response SLA- builds above 13.0

                      Before following the below steps, ensure that you have the option "Enable First response by default for notes addition" under Admin - > Self Service portal settings. 1. Go to Admin - > general settings-> Global Functions and click on New. Copy the ...
                    • Script to satisfy first response SLA

                      As of now only for the following scenarios, First response can be marked in the MSP application, * Notes addition * Worklog addition * Technicians manual response Apart from this if you want to mark any other actions in the application as First ...
                    • How to implement dynamic request approval using FAFR and custom triggers - Deluge

                      This is a sample script written in Deluge to handle Conditional Approvals for Incident \ Service Requests, through Custom Triggers using Field and Form Rules.  One of the advantages of using this script that no modification in the script is required ...
                    • Script to satisfy first response SLA in SCP 11

                      As of now only for the following scenarios, First response can be marked in the SupportCenter application: * Notes addition * Worklog addition * Technicians manual response Apart from this if you want to mark any other actions in the application as ...
                    • Update a request based on certain values - Deluge

                      This post describes the use of a deluge script to update requests based on values given a global function, namely "request_properties".  This action can be performed using Custom Triggers. Refer to this link for Python ...