Duplicate ticket numbers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2016 05:47 AM
Hi Experts,
Can anyone help me with how to prevent duplicate ticket numbers being created in servicenow?
Scenario,
1) tickets are getting generated with the same ticket numbers (sys_id is different).
2) the solution has to be in a way that should not affect existing tickets even though the existing tickets might have duplicates but those tickets should not be disturbed , this should be applicable only to the future tickets in case duplicate numbers getting generated.
3) I am working on eureka version, and shared environment so we cant disturb the number maintenance table.
Can anyone suggest me taking the scenario's into consideration how to develop a business rule to prevent duplicate ticket numbers being generated in future??
Regards,
Nivedita

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2016 05:53 AM
Hi,
How are you generating ticket number?
Use the Auto Numbering option provided by ServiceNow if you are not using it.
http://wiki.servicenow.com/index.php?title=Managing_Record_Numbering#gsc.tab=0
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2016 11:06 PM
Hi,
I am using auto numbering, but i cant use unique index because currently i am working on Eureka version and unique index is available from Fuji.
Could you provide me some other way to achieve this.
Regards,
Nivedita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2017 10:12 AM
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.