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 ADManager Plus?

                    New to ADSelfService Plus?