delete the list of CIs from ServiceNow

gma
Giga Contributor

delete the list of CIs from ServiceNow.?

7 REPLIES 7

Mihir Mohanta
Kilo Sage

Why you want to delete CIs from ServiceNow?



You can retire them as those CIs might used in different records of ServiceNow.


Deepak Kumar5
Kilo Sage

You can make it retired instead of deleting it.


If your requirement is to delete then select those record from list view and delete it.


If number is huge, you can run a background script to delete these.


i have lis of CI to delete,Can u help me out


Run this script in 'Background script' after adding conditions to get all those records in your table



deleteRec();  


function deleteRec()  


{  


var rec = new GlideRecord('cmdb_ci');


rec.addQuery('Field_Name','Validation value');


rec.setLimit(10);   //Check for 10 record first then increase it


rec.query();  


while (rec.next()) {      


  rec.setWorkflow(false);  


  rec.deleteRecord();  


}  


}