Dynamically set SLA based on field values

Dynamically set SLA based on field values

Requirement:
SLA for service requests needs to be set depending on the category, subcategory and priority of the request.

Usecase:
The possibility to modify/set SLA depending on a request Field is not available in Service Request.
Also, since SLA is an editable field, requesters can change it to their convenience.  As a result, in an organisation, automatically setting the SLA based on request fields becomes more important.

Note:  Category, Subcategory and Priority need to be populated in the request for the script to work.

Steps to configure:
1.  Download the attached scripts.  Copy the contents into Request custom functions.

2.  Goto Admin > Request Custom Function > Global Function > New > Paste the global function contents and save it with a name.
Update the URL and integration/technician key in the script. 
  1. For builds over 11300, you can get the integration key under Admin > Integrations > Integration Key > New
  2. Please use an integration key with admin privilege, as there wont be any role related permission issues. 

  3. For builds prior to 11300, refer https://help.servicedeskplus.com/api/rest-api.html$key and update the technician key.

3.  Goto Admin > Request Custom Function > Custom Function > New > Paste the Set_SLA.txt content and save it with a name
Update the global function count according to your instance

4.  Update the SLA Matrix as per your choice.  Please follow the below format.
  1. {
  2. <Category_name> : {
  3. <Subcategory_name> : {
  4. <priority_name> : <SLA_name>
  5. }
  6. }
Sample is included in the script itself.  Please follow the comments to edit the Matrix with in the script.

5.  Configure this in a custom trigger to get invoked every time a request is created. (Invoking Condition can be modified as per your requirement.)

                  New to ADSelfService Plus?