Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Retiring large amount of CI

lourenz
Tera Contributor

I have a requirement to Retire thousand Cis that is already outdated. Where updated field not on the current year and is empty using Busines rules

2 REPLIES 2

Abbas_5
Tera Sage
Tera Sage

Hello @lourenz ,

Please refer to the below link:

https://www.servicenow.com/community/itom-forum/how-can-i-bulk-update-the-status-value-to-retire-for...

 

If it is helpful, mark it as a thumps-up and accept the correct solution.
Thanks & Regards,
Abbas

Danish Bhairag2
Tera Sage

Hi @lourenz ,

 

U need to create a Fix script for this where u can write a GlideRecord query & update the required amount of CI's in a go. If the CI's are 10k-20k or even more then better to do it in multiple batches. 

var gr = new GlideRecord('cmdb_ci');//please modify the table name as per requirement
gr.addEncodedQuery('Paste the query copied form List view from the backend');
gr.query();
while(gr.next()){
gr.operational_status = 'retire';//please use proper backend value for retire
gr.update();
}

 

Thanks,

Danish