Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

duplicate serial numbers asset

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);

}
Source by community.servicenow.com #
 
PREVIOUS NEXT
Tagged: #duplicate #serial #numbers #asset
ADD COMMENT
Topic
Name
8+3 =