Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Finding Duplicate Serial Numbers

SkipperJim
Kilo Contributor

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.

1 ACCEPTED SOLUTION

Peda
Mega Expert

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

View solution in original post

6 REPLIES 6

We are in the same boat here.
Have you found a way to solve this?

We have not found a solution and the Remediation meetings for this are a time killer.