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 ADManager Plus?

                  New to ADSelfService Plus?

                    • Related Articles

                    • 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 ...
                    • Request Approval Details

                      This report is used to view the historical details of Approved and Denied approval processes and their individual steps. We can also use this report to display all details for which an approval decision is pending. To make any changes to a query, ...
                    • Close comments

                      This report is used to find the close comment added by requester.  To make any changes to a query, refer to the KB article below. https://pitstop.manageengine.com/support/manageengine/ShowHomePage.do#Solutions/dv/24000627781192 SELECT wo.WORKORDERID ...
                    • Close requests with pending approval for more than 10 days

                      Requirement:  Close older requests with pending approvals. UseCase:  Close all requests for which approvals have been sent but no action has been taken in more than 10 days. Please follow the below steps.  Goto Reports > New Query Report > execute ...