Automating deactivation of unused Standard Change Templates after 6 months
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi Team,
I have a requirement to automate the deactivation of unused Standard Change Templates and would like guidance on the best approach.
Requirement:
If the following conditions are met:
Template is Active = true
The Last Closed Proposal Closed Date is older than 6 months from the current date
The Last Change execution (states like Closed / Implement / Review) is also older than 6 months
Then the system should:
Automatically deactivate the template
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi,
You can achieve this requirement using a scheduled job + script. Below is a recommended approach:
- Create a Scheduled Script Execution:- Run daily/weekly depending on your need.
- Query Standard Change Templates
- Table:
std_change_template - Condition:
active = true
- Table:
- Validate the 2 conditions
- Last Closed Proposal Closed Date
- Reference table:
std_change_proposal(or related proposal table) - Check if the latest closed proposal date is older than 6 months.
- Reference table:
- Last Change Execution
- Table:
change_request - Filter by template and states like Closed / Implement / Review
- Get the most recent execution date and verify it's older than 6 months.
- Table:
- Last Closed Proposal Closed Date
- Deactivate Template
- If both conditions are satisfied → set
active = false
- If both conditions are satisfied → set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @akashyada1
The approach is good, but you need to execute the query in two steps. First, query the change table to retrieve records older than six months. From those results, you will get the template names. Then, use those template names to query the template table[std_change_record_producer] and deactivate the corresponding records.
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
You can use the flow designer for thism which is low code/no code.
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]
****************************************************************************************************************
