- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 04:36 AM
Hello Team,
I/'m trying to delete all the records which I have loaded using import set. i'm trying to delete manually but some how few records are still showing up when I click on that records it's showing record not found.
Can anyone help me to delete all the records using any script.
Thanks,
JRY
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2020 04:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 04:45 AM
Hi Jry,
You can do what you need via a glide record as follows:
var theRecords = new GlideRecord("<your table name>");
theRecords.addQuery(<addd the criteria to isolate your records>);
theRecords.Query();
var theRecordsCount = theRecords.getRowCount();
gs.addInfoMessage("Retrieved " + theRecordsCount +" rows");
return;
theRecords.deleteMultiple();
I set this up so that when you first run this, you can confirm that the right number of records are being captured. Once you are satisfied that all the records you need to delete, and only those, are being captured in the query, you can take out the return statement.
You will need to include as many theRecords.addQuery() (or similar) statements to assure that you can properly specify your needed records.
Hope that helps.
:{)
Helpful and Correct tags are appreciated and help others to find information faster
:{)
Helpful and Correct tags are appreciated and help others to find information faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 04:56 AM
I tried it but not working still I can see ghost records which are there in hardware asset list when I clicking on the any records it's showing record not found
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 06:20 AM
Please provide more information, e.g. screen prints including your criteria and resulting records that are not being removed.
You may also need to see if there are security or similar constraints that are preventing you from accessing those records.
Hope that helps.
:{)
Helpful and Correct tags are appreciated and help others to find information faster
:{)
Helpful and Correct tags are appreciated and help others to find information faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 07:03 AM
can you please go through with above screen prints in that last screenshot you can see that records are not getting deleted and
i need one more i'm trying to computer set the class in the import set tables,so all the assets are just created in the cmdb_ci table instead of the sys_name_class. for that i have written below script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2020 04:17 AM
What I'm seeing from where this thread has gone (sorry I had production issues yesterday), you are looking at two tables cmdb_ci and alm_hardware along with a side issue of setting the state correctly.
To start ignore the question of setting the state. Focus on what is most important and address the issues one at a time.
The first issue is what table does the transform map update? Does the transform map have the Run business rules box checked? If so do you have any BRs that cross populate the other table or do your transform scripts apply the data to both tables?
Have you confirmed that there are not security constraints that prevent you from deleting certain records?
Hope that helps.
:{)
Helpful and Correct tags are appreciated and help others to find information faster
:{)
Helpful and Correct tags are appreciated and help others to find information faster