Change Auto closure

Change Auto closure

This will be helpful in auto closing change request after X days it is in review stage. This use case is more suitable in environments where ONLY Requesters (customers) are the Change Reviewers and they want the Change to be closed if no review is done after 7 days. In these cases, customers wants this to be auto closed just like Request closing rules.

Kindly execute the below query and save it after running it under Reports->New Query Report. Feed this saved Query as Arguments under Admin->Custom schedule.

SELECT chdt.CHANGEID AS "change_id"  FROM ChangeDetails chdt LEFT JOIN Change_StageDefinition stageDef ON chdt.WFSTAGEID=stageDef.WFSTAGEID LEFT JOIN Change_StatusDefinition statusDef ON chdt.WFSTATUSID=statusDef.WFSTATUSID LEFT JOIN ChangeHistory cdh ON chdt.CHANGEID = cdh.CHANGEID LEFT JOIN ChangeHistoryDiff cdhd ON cdh.HISTORYID = cdhd.HISTORYID  where (stageDef.DISPLAYNAME = 'Review')  and  cdhd.COLUMNNAME in ( 'WFSTAGEID') and DATEDIFF(day, dateadd(s,datediff(s,GETUTCDATE() ,getdate()) +(operationtime/1000),'1970-01-01 00:00:00'),GETDATE()) > 2 group by chdt.CHANGEID

You can also verify the output of the query using the below query before scheduling.
 
SELECT chdt.CHANGEID AS "change_id", 
max(stageDef.DISPLAYNAME) AS "Stage", 
max(statusDef.STATUSDISPLAYNAME) AS "Status",
longtodate(max(operationtime)) "Operation time" FROM ChangeDetails chdt LEFT JOIN Change_StageDefinition stageDef ON chdt.WFSTAGEID=stageDef.WFSTAGEID LEFT JOIN Change_StatusDefinition statusDef ON chdt.WFSTATUSID=statusDef.WFSTATUSID LEFT JOIN ChangeHistory cdh ON chdt.CHANGEID = cdh.CHANGEID LEFT JOIN ChangeHistoryDiff cdhd ON cdh.HISTORYID = cdhd.HISTORYID  where (stageDef.DISPLAYNAME = 'Review')  and  cdhd.COLUMNNAME in ( 'WFSTAGEID') and 
 DATEDIFF(day, dateadd(s,datediff(s,GETUTCDATE() ,getdate()) +(operationtime/1000),'1970-01-01 00:00:00'),GETDATE()) > 2 group by chdt.CHANGEID

The script and Custom schedule config page reference are attached. By Default, scripts should be placed in [SDP MSP_Home]/integration/custom_scripts/ directory
                  New to ADManager Plus?

                    New to ADSelfService Plus?

                      • Related Articles

                      • Send Auto reminders to Change Approvers after X days

                        Here is the script and kindly follow the steps below to achieve your requirement to send Auto reminders to Change Approvers after X days. For now, the script sends reminder for every 24 and 48 hours. This can be customized in the script. 1.Download ...
                      • Script to Auto close Request when the status is set to Resolved

                        This post describes the use of a python script to close requests that are set in Resolved status using Custom Schedules What is 'Custom Schedules' ? The Custom Schedules feature enables you to access any data in ServiceDesk Plus to perform customized ...
                      • 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 ...
                      • Script to automatically close change that have passed their scheduled time.

                        Please follow the below steps. 1. Go to Reports tab --> New query report --> copy the query to the query editor and run the report. Save the report in the folder. The query is available in the attachment (query.txt). Modify the status in the query. ...
                      • Script to bulk close change using deluge script based on the status

                        The following script will help you bulk close changes based on the status of change using custom schedules 1. Go to Reports tab --> New query report --> copy the query to the query editor and run the report. Save the report in the folder. The query ...