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

                    • Related Articles

                    • Script to Auto close Request when the status is Resolved for a particular number of days

                      For version 11 and above: -> In version 11, we only have the option to set the request Auto-close for a max of 10 days -> The below script will help you to extend the auto-closure time Execution steps: 1. Go to Reports--> New Query Report and run the ...
                    • 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 ...
                    • Auto Populate Scheduled Start Time and End Time in Change Request

                      We can now auto-populate the Scheduled Start Time and End Time in a change request using FAFR. Under Admin>Change Template>Field and Form Rules, you can use the below scrips Scheduled Start Time var x=$CS.getValue("SCHEDULEDSTARTTIME"); if ( x === ...