Deluge Script to achieve First Response SLA- builds above 13.0

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 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;

Kindly give a unique API name as this API name will be called in the custom function.



  







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 Custom Actions under Admin - > Request Custom Function, and add new custom Action. Add the script content mentioned below as shown in the following screenshot.

configuration = test1();
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 API name is called here in the script as highlighted in the screenshot. 

( 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

                    • 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 ...
                    • 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 ...
                    • Send escalation email to the Technician "Reporting to" if SLA is violated (Deluge).

                      From Builds 10600 and above Follow the below steps and based on the update we need to create a custom trigger based on the action set under the SLA escalation notification and then with the help of that we can execute the custom trigger and the ...
                    • 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 ...
                    • Query report for Time Spent for First response in Version 11.0 (Postgres)

                      SELECT slad.SLANAME AS "Request SLA", wo.WORKORDERID AS "Request ID", longtodate(wo.CREATEDTIME) AS "Created Time", slad.SLANAME AS "Request SLA", longtodate(wo.FR_DUETIME) AS "Request first response due time",round(wo.RESPONSE_TIMESPENT / 60000) AS ...