Script Master - 3: How to implement dynamic request approval through custom triggers with configurable CSV file.

Script Master - 3: How to implement dynamic request approval through custom triggers with configurable CSV file.

Good morning folks!

 

First, I'd like to wish all our users a happy thanksgiving on behalf of ManageEngine Pitstop.


We all know that one size doesn't fit all. This is true even in the case of request approvals. Not every request must be imposed with the same approval mechanism.  So this week, the Script Master's post is about having  a dynamic request approval mechanism in place through custom triggers with configurable CSV file .


In case you've missed the Script Master's post last week, head here.


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.


In order to handle the approvals effectively, the IT Admin provides approval codes to all the users in their organization which  is mandatory  to raise specific type of requests. Now the list of approvers for each of these approval codes is populated in  a CSV file and provided as input to a script that is invoked using custom triggers. The  script  to handle conditional approvals is available 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.


Execution steps:

 

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


2. Update the input to the variable 'fieldvalue' with the help of necessary comments in the script. 

Note: The variable called ' fieldvalue ' stores the actual data from the request field, based on which the approval is set.


The first column in the CSV file has the name of the fields based on which the approvals are  triggered. The second column has the different values that are the input to that field. Based on each value(criteria) the list of approvers will change.  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 . Provide the name of the field based on which the approvals are triggered as the first parameter and the second parameter is the  request json file.


Following is a screenshot showing a sample configuration.




Take a look at the following video for more information on configuring the script and the CSV  file.



Note:

1.  This script was tested on python v3.4.1 - 32 bit.

2.  This script can be used in ServiceDesk Plus version 9114  and above. 

To make the best use of this script, take a look at the comments in the script and the related post in our resources  section.

 

Trust you find this post useful. Try it and send your feedback to us as comments to this post. See you next Wednesday with another useful script.

                New to ADManager Plus?

                  New to ADSelfService Plus?