Duplicate records with same number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
When records are imported through Data Import Sets, the record numbers are not being generated in the correct sequence. Instead, the numbers are getting assigned in a jumbled or non-sequential order.
Also, when we create records manually, sometimes a number that already exists is being assigned to a new record. Although the record numbers are the same, their sys id values are different.
Could you please help us understand why this is happening and how we can fix the issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hello @vijani ,
Try running this code,
If duplicates are found, the issue must be due to custom logic or a past data load that bypassed normal number generation rather than the sys_number sequence itself.
var ga = new GlideAggregate('your_table_name');
ga.addAggregate('COUNT', 'number');
ga.groupBy('number');
ga.addHaving('COUNT', '>', 1);
ga.query();
while (ga.next()) {
gs.print('Duplicate Number: ' + ga.number +
' Count: ' + ga.getAggregate('COUNT', 'number'));
}
So changing the series in sys_number only changes formatting and will not stop collisions. Instead I would recommend go to Number Maintenance, click Show Counter, and set the sys_number_counter value higher than the highest existing record number in your table.
If my response helped mark as helpful and accept the solutions.