Auto close changes records

Akhil32
Tera Contributor

Hi Team,

Here is my use case:

“Auto-close any change record that has been in the Implement state for more than 24 hours after its planned end date and time has passed. The change should be closed with the close code Unsuccessful and the close code reason Abandoned.”

Need some suggestions to implemented this, I know we do it via scheduled script. is there any other way to achieve this using flow designer. not familiar with flows

Give some suggestions
3 REPLIES 3

tiagomacul
Giga Sage

Automating the lifecycle of Change records is a critical step toward operational efficiency. While many organizations still rely on legacy Scheduled Scripts, the modern architectural approach in ServiceNow is to utilize Flow Designer. This ensures the solution is easier to maintain, audit, and upgrade.

 

 

Based on industry best practices and official frameworks, here is the recommended approach to satisfy this requirement:

 

1. Using Flow Designer (The Modern Approach) Flow Designer is the 'Out-of-the-Box' (OOB) standard for this type of automation. It eliminates the need for complex scripting and provides a clear visual representation of the logic.

  • Trigger: Set the trigger to 'Daily' or 'Repeat' at a specific interval.

  • Look Up Records: Use the 'Look Up Records' action to find Change Requests where:

    • State is 'Implement'

    • Planned end date is relative 'before' 24 hours ago

  • For Each Loop: Iterate through the results and use the 'Update Record' action to:

    • Set State to 'Closed'

    • Set Close code to 'Unsuccessful'

    • Set Close notes to 'Abandoned'

 

2. Why Flow Designer over Scheduled Scripts? From an Enterprise Architecture perspective, choosing Flow Designer aligns with Pillar 5 (Data Governance) and ensures a sustainable 'TO-BE' state:

  • Traceability: Every execution is logged, providing a clear audit trail of why a Change was closed.

  • Maintainability: Business stakeholders can understand the logic without needing to read JavaScript code.

  • Upgrade-Safe: Flows are less likely to break during platform upgrades compared to custom scripts.

 

https://www.slideshare.net/slideshow/servicenow-incident-auto-close-configuration-pdf/275085671

 

Georgian R_
Tera Contributor

What you need is a flow that will look up for all the change records in state implement and planed end date before 24 hours ago & not empty. Add closed notes as you wish.

GeorgianR__0-1768833229562.png

 

Dr Atul G- LNG
Tera Patron

This is not a good approach, especially from a change management perspective. A change should not be automatically closed immediately; it should only be closed after the Review state is completed. The reason is that the change must go through the PIR process.

Also, what happens if an agent fails to update the state of a change even though the change was implemented successfully? And what about changes that look successful on paper, but fail in reality? Are we going to revert those even though the change was marked as unsuccessful?

There are many open points here. We should first focus on defining and fixing the process. Once the process is clearly set up, then we can move forward with a technical solution.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************