Retire Stale CIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 04:13 AM
Hi,
I have stale CIs around 8k and out of them 4k are already retired. Why those are all included the stale CIs if it was already retired. And i need to retire the stale CIs as retired as a bulk. How can i do it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 04:19 AM
might be helpful
https://www.servicenow.com/community/cmdb-forum/process-to-retire-stale-cis/m-p/2367874
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/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 04:37 AM
Hi @VISWANATH KAMAL ,
If the query used to identify stale CIs does not exclude records already marked as "retired," they will appear in the result.
You can use fix script or background script to update the stale ci.
// Update stale CIs to Retired
var gr = new GlideRecord('cmdb_ci'); // Change table if specific class
gr.addQuery('sys_updated_on', '<', 'YYYY-MM-DD'); // Replace with your date filter
gr.addQuery('install_status', '!=', 7); // Exclude already retired CIs
gr.query();
while (gr.next()) {
gr.install_status = 7; // Set to Retired
gr.update();
}
gs.print('Stale CIs updated to Retired status.');
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 05:23 PM
@VISWANATH KAMAL Setting the status to retired doesn't impact the health score as those CIs are still considered in health job computation. I would strongly suggest to archive those CIs rather than retire it using the data manager policy.