Associate Checklist for a Request depending on Resource/UDF Values

Associate Checklist for a Request depending on Resource/UDF Values

Requirement:
Script to associate checklists depending on UDF Additional field values/Resource Question values.

Usecase:
In few organizations. they have a separate template for "New Asset Request". 
Each new asset needs a different set of checklists to be followed before delivering the asset to the requester.
Depending on the values chosen, the respective checklist has to be associated with the request.

Requirement 1:  For a single Asset Request
Case 1: This value can be maintained as a Request Picklist Additional Field
Case 2: This value can be maintained as a Resource - Dropdown Question

Requirement 2:  For multiple Asset Request
Case 3: These values can be maintained as a Resource - Checkbox Question
Case 4: These values can be maintained as a Request Multiselect Field

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 customfunction.txt content and save it with a name
(Update the global function count according to your instance and the checklist values)‚Äč


4.  Configure the created custom function in a trigger to get executed every time a Service Request is created, with certain criteria.


Note:
  1. Update the mapping for the Checklist values within the script.
  2. From CustomFunction.zip, use the function as per your requirement.