Automatically close request after successive approval reminders.

Automatically close request after successive approval reminders.

This post describes the use of a python script to close requests after successive approval reminders using Custom Schedules.

Use Case:

We have an option under the self-service portal in order to send reminders mail for the approvals, what would be the case once all the mentioned reminders are sent and still the ticket remains unnoticed, and the technician needs to have a look at the pending every once in a while .
We can configure a custom schedule to close the requests, and also add a note in the ticket stating "closing the request since the approver has not approved after repeated follow ups"

Execution steps:

1. Go to Reports--> New Query Report and run the below query and save this report.


SELECT wo.WORKORDERID AS "workorderid"  FROM WorkOrder wo 
LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID 
LEFT JOIN ApprovalStatusDefinition appStDef ON wos.APPR_STATUSID=appStDef.STATUSID 
LEFT JOIN Approvalstagemapping on wo.workorderid=approvalstagemapping.workorderid
LEFT JOIN Approvaldetails on approvaldetails.approval_stageid=approvalstagemapping.approval_stageid 
left join approvalreminder ar on Approvaldetails.approvalid=ar.approvalid
 WHERE (wo.ISPARENT='1')   and std.ispending='1' and appStDef.STATUSNAME like '%pending%' and ar.Reminder_count = 3 group by wo.workorderid


2. Downloaded the attached Zip file and move the files to ManageEngine/ ServiceDesk/ integration/custom_scripts folder
3. Edit configuration.json file and update the application URL and the Technician Key
4. Configure the schedule under Admin--> Custom Schedule

I've attached a screenshot showing a sample implementation below.




A short guide on setting up python is available  here
Refer to the link below in order to setup the schedule,

                    New to ADSelfService Plus?

                      • Related Articles

                      • Close the request upon adding a note.

                        Kindly follow the steps mentioned below: 1) Go to Admin >> Developer Space >> Custom Function >> Global Functions >> Copy & Paste the attached GF_Content.txt and save it with a name. Update the URL and technician key as per your instance. Refer to ...
                      • Query to get approval status per request with approvers by account (MSSQL)

                        Tested in build MSSQL (14306) SELECT wo.WORKORDERID AS "Request ID", wo.TITLE AS "Subject", wo.DESCRIPTION As "DESCRIPTION", aau.FIRST_NAME AS "Requester", dpt1.DEPTNAME AS " Requester Department", srep.First_Name As "Suprep", qd.QUEUENAME AS ...
                      • How to close associated incident requests of change request automatically

                        This post describes the use of a python script to close change that are in a specific stage using Custom Schedules. Use Case: There may be a scenario where number of Change Requests that have got closed and the associated incident is still in open ...
                      • How to close linked requests when a parent request is closed.

                        This post describes the use of a python script to close all the linked request when a parent request is closed using custom triggers. Use Case: We get tickets which are getting reported for the same issue but different end-users so that once we ...
                      • Set SLA automatically for a service request using FAFR

                        Note: The below FAFR script will work only on 10600 MSP and above Requirement: Set SLA automatically for a service request depending on the Priority. Usecase: Let us consider a scenario where SLA has to be set depending on the requester's associated ...