How to close associated incident requests of change request automatically

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 status.

Execution steps:

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

SELECT chdt.CHANGEID "changeid", wo.WORKORDERID "workorderid" FROM ChangeDetails chdt
LEFT JOIN Change_StatusDefinition statusDef ON chdt.WFSTATUSID=statusDef.WFSTATUSID
INNER JOIN IncidentToChangeMapping icm ON chdt.CHANGEID=icm.CHANGEID
LEFT JOIN WorkOrder wo ON icm.WORKORDERID=wo.WORKORDERID
LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID
LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID where std.ispending='1' and statusDef.STATUSDISPLAYNAME = 'completed'

This will give you the ID of requests associated to change request which is completed. Please update the query based on your requirements.

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,
https://help.servicedeskplus.com/configurations/general/custom_schedules.html

ReplyReply AllForwardEdit as new

                    New to ADSelfService Plus?

                      • Related Articles

                      • Query to get all the requests associated to a change (MSSQL & PGSQL)

                        Tested in builds PGSQL (14300) or MSSQL (14306) Postgres Query: select chd.ChangeID "Change ID", chd.title "Change name", wo.workorderid "Request ID", wo.title "Request Subject" from incidentcausedbychange incach left join ChangeDetails chd on ...
                      • 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: Close associated changes when a request is closed

                        Use case:  In many cases, the client never comes back to confirm the change. This means that the change remains opened indefinitely. When the ticket is closed it is logical that the change to be closed. No one is going to close a ticket unless the ...
                      • Close Multiple associated Requests to Problem with one resolution

                        By following the below steps we can Copy one problem solution and workaround to all associated incidents Instructions 1. Create a problem ticket. 2. Associate incidents to the problem to the ticket. 3. Under Admin>Problem Closure Rules you can set ...
                      • 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 ...