- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 10:10 AM
Is there a way to identify/report on duplicate serial numbers in the asset database in ServiceNow? Export dumps limits to 150K records for using alternative tools/methods, but we have more than 150K rows in the database.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 10:18 AM
Hi SkipperJim
this will help.
var gaDupCheck = new GlideAggregate('alm_asset');
gaDupCheck.addAggregate('COUNT', 'serial_number');
gaDupCheck.addNotNullQuery('serial_number');
gaDupCheck.groupBy('serial_number');
gaDupCheck.addHaving('COUNT', '>', 1);
gaDupCheck.query();
while (gaDupCheck.next()) {
var gr = new GlideRecord('alm_asset');
gr.addQuery('serial_number',gaDupCheck.serial_number);
gr.query();
gs.info('Duplicate serial number: ' + gaDupCheck.serial_number);
}
best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2023 06:53 AM
We are in the same boat here.
Have you found a way to solve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 03:45 PM
We have not found a solution and the Remediation meetings for this are a time killer.