Script to find the actual SLA of an Incident

Script to find the actual SLA of an Incident

Use case

When an incident is logged, the timer for the SLA is started. However, the actual incident might have occurred hours before the incident creation. In order to find the actual time of SLA,  we can use a python script. 

Pre-requisite 

Python should be configured in the application server along with the request module. Instructions here

Steps

1. Download the file from the attachment, extract it and place the autoclose.py under ManageEngine\ServiceDeskPlus-MSP\integration\custom_scripts

2. Make the below changes in the files

2a. configuration.json

If you already have a configuration.json given for any other script, you can ignore this. If not please proceed. 

The URL of the application and TechnicianKey should be updated. If you have not done it already, click on the user bade on the top right corner and click on API Key generation. 



2b. UpdateSLATime.py

In the application, go to Admin >> Incident - additional Fidls, note the API field name for the fields, and enter it into the script




3. Under Admin >> Custom Trigger >> Create a condition on which this action should be carried out and set the script name as below 

py UpdateSLATime.py $COMPLETE_V3_JSON_FILE or python UpdateSLATime.py $COMPLETE_V3_JSON_FILE


Save the files and test the output. 








                  New to ADSelfService Plus?

                    • Related Articles

                    • Cannot run program "python" or Can't find a default python

                      Use case While trying to run a python script, this error can be found. It usually occurs when the python is not installed/set up properly. Solution Try specifying the complete path of the python.exe instead of py and then in the argument specify the ...
                    • Python script to automate FCR

                      Please find the attached Python script on this link  to automate FCR via custom trigger when the request is created and resolved by the same technician. The link contains two Python scripts with the name FCR.py (this script can be used when MSP is ...
                    • How to diff of two Date& Time fields using FAFR

                      If you have two date and time additional fields or default fields, and if you want to capture the difference between those two fields in Hours and minutes, then use the below script to capture the value in an additional field, Under the respective ...
                    • Update status using Python script in 11.0

                      Using a Python script via custom trigger, we can update the status invoking an API call. A short guide on setting up python is available here : https://pitstop.manageengine.com/portal/kb/articles/how-to-setup-python-on-the-server Find the attached ...
                    • Script to Auto share request

                      1. Download MSP_share_Request.zip from the attachment, extract it, and paste the same under ManageEngine\ServiceDesk Plus MSP\integrations\Custom_scripts.          # auto_share_MSP.py      # functions.py      # configuration.json 2. ...