How to implement dynamic request approval through custom triggers with configurable CSV file.

How to implement dynamic request approval through custom triggers with configurable CSV file.

This is a sample script written in Python to handle Conditional Approvals for Incident \ Service Requests, through Custom Triggers.More information about Conditional Approvals can be  found in the link here

One of the advantages of using this script is that we have minimized the changes that needs to be done to the script to get it working.The name of the fields based on which the approvals are to be processed and the list of approvers for different values in this field are provided in a configurable  CSV file.

User Case:

Lets assume that in a large organization, when users request a service from a long list of offerings, it  makes no sense if all the services go through the same set of approval processes. As most of the services would have different set of approvers and approval levels, it is mandatory to customize the request approval processes.  This post helps IT administrators to dynamically set approvers at different approval stages directly in the request without the need to configure them in the template. With the help of custom scripts, the list of approvers is submitted to the application in a specific json structure through which dynamic approval mechanism is implemented for both incidents as well as service requests.

A short guide on setting up python is available here.

Execution steps: 

1. Copy the script and the configuration file into the custom script folder in the \Manageengine\ServiceDesk\integration directory.

2. Update the CSV as in the attached screenshot


The first column in the CSV file has the name of the field and the value based on which the approvals are  triggered.   The next five columns each holds the email addresses for which the approvals have to be sent,  from stages 1 through 5. If there are more than one email addresses in any of these 5 columns, they should be separated by a ';' (semicolon).Each column in the CSV  file is separated by a ',' (comma). 

3. Configure the script under the  Admin --> Custom Triggers . 

 py ConditionalApproval.py $COMPLETE_V3_JSON_FILE

Following is a screenshot showing a sample configuration.


Take a look at the below  video for more information on configuring the XML file.