Stubborn records refuse to be deleted.. Ideas??

dline
Giga Contributor

Background:


I've been setting up Asset management for our Company, loading data etc, determining if I have all my transform maps set up correctly etc, refining, and such, well in this process of uploading several excel sheets multiple times, I now find myself with about 230 "ghost" records. I've tried deleting these records a couple of different ways, and can't get them to disappear.


Details :

I've tried going to

Product Catalog > All Models and Product Catalog > Hardware Models directly, clicking the check boxes next to the items I want to remove then going to the bottom of the page and selecting Delete from the pull down to perform on selected rows.

 

I have also gone to

System Definition > Tables and Columns > Model Name [cmdb_model] and System Definition > Tables and Columns > Hardware Model [cmdb_hardware_product_model] and highlighted each then hit the delete all records button, entered "delete" in the caution box, and attempted to delete the records that way. I have tried this multiple times, and when I attempt now, I get a message that the table is already empty.

 

I do all of this yet, I still am presented with the same data basically 231 "records" but when you click on them, it says the record does not exist...

 

Any suggestions?

Doug LIne

3 REPLIES 3

solutioningnow
Giga Guru

Hi Doug,



Usually you can't delete any ghost records directly once created.


You can give try on writing background SQL query to delete or you may have to raise an HI ticket to clean up of this table.



Please mark answer as correct/helpful, if it was helpful



Regards,


Solutioner


Logo.png


Enhance Knowledge NOW@ www.solutioningnow.com


http://www.solutioningnow.com/


Bhavesh Jain1
Giga Guru

Yes. You will have to write SQL query something like :



gs.sql('select COUNT(*) from table_name c where 'c'.sys_id NOT IN(SELECT syts_id FROM cmdb_ci)');


Mark Laucus
Giga Guru

I had this issue and I had to get with ServiceNow to assist with fixing.   There is a problem PRB575577 that identifies this issue.   Generally they will have you rerun the plugin for model records and then provide you two scripts to resolve (info shown below)



1) Re-run activation for plugin com.snc.model



2) Run fix scripts in Scripts - Background (Run each of these individually. It is possible each script will need to be run multiple times until a message similar to "No broken records found" is displayed.
gs.loadBatchScript("fix_models_sys_class_class.js");
gs.loadBatchScript("fix_model_parents_to_components.js");



I would recommend looking up the problem record and if recommended get the scripts from ServiceNow.