- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 12:28 PM
Hi,
We are finding duplicate incidents created with same numbers. and I found there is a OOB unique option. Setting unique to true on number field will solve that issue? and does anyone have any idea what is the root cause of this issue?
Thanks,
Ganga
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2024 09:25 AM - edited ‎02-20-2024 09:27 AM
I have recently overcome this issue. the below given solutions may help.
solution1 :
go to the dictionary of number field, you can set the default value of the number field as
solution2 :
go to the system properties list and search for "glide.itil.assign.number.on.insert", and set the value as 'true'.
please mark it as helpful and "accept as solution".
regards,
Ubada Barmawar.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 12:38 PM
Please check if you find this helpful: Duplicate incidents are created with same incident number but different sys_id?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 01:02 PM
Apparently, duplicate numbering could happen as there is no checks in place for it to NOT happen. We opened a HI ticket and found out this is by Design. One solution is as follows:
Create a before Insert business Rule as follows:
//
// checks if a duplicate number exists and if so get the next one.
//
checkNumber();
function checkNumber()
{
var gr = new GlideRecord('table'); //Change the 'table' to the table you want this business rule to apply.
gr.addQuery("number", current.number);
gr.query();
if (gr.next()) {
var oldnumber = current.number; current.number = getNextObjNumber();
gs.log("renumbered record number " + oldnumber + " to " + current.number + " because it was a duplicate");
}
}
I hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2017 08:41 AM
Dear Gangadhar,
We implemented it by creating a before insert business rule that runs on table ( ex: incident).
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('incident');
gr.addQuery('number', current.number);
gr.query();
if(gr.next()) {
gs.addErrorMessage("An incident is already present with the same number " + current.number);
current.setAbortAction(true);
}
})(current, previous);
The tricky part is to test this solution, cos system wont let us create a record directly on that table from UI as the number field is read only. I used the REST API explorer to create a record.
Thanks
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2018 04:25 PM
Gangadhar,
I have recently run into this issue and although the above responses are correct I feel there is a simpler way that works for all tables that use numbering coming from the Task table.
Create the business rule as described in the "Enforcing unique numbering" from the link below.
https://docs.servicenow.com/bundle/kingston-platform-administration/page/administer/field-administration/concept/c_EnforcingUniqueNumbering.html
When you select the table for the BR, select the TASK table. This will allow the BR to run on all numbering tables that extend from the Task table (Incident, Request, Problem, etc). Anyone that creates a new record will have this before insert rule determine if the number is the next number in line and not a duplicate of a previous one.
You can test this out in any sub-production environment by changing the Number Count for that table back one number and creating a new record. The BR will find that the number has been used and will automatically bump it to the next number available.
Hope this helps.
Marshall