Community Alums
Not applicable

Hola Folks,

Recently we faced an issue in our prod environments where Incident numbers were being generated duplicate and it was becoming quite common. It caused us lot of pain and problems in integrity of data. This can happen on any of the task tables and it needs to be fixed very quickly as it might affect lot of reporting as well.

The unique identifier for all records, including duplicate records in ServiceNow, is the respective sys_id generated by the system. By default, ServiceNow does not enforce uniqueness on the task.number column. This opens the possibility of having records with the same number.

 

Probable Reason for this to occur :

  • Reason 1:
    The issue can occur from multiple pushes being made to the submit button. Although generally this is in conjunction with a network latency issue (i.e. where a push is sent and upon reconnection, another push is sent separately), it can simply occur without.
  • Reason 2:
    One possibility is if there is a double insert caused by a business rule that contains a current.update or an .update when the record is inserted.
  • Reason 3:
    One scenario is where you cloned over from production and production already have that number.

Solution Proposed

As of now, unless there is a way to reproduce this issue, or if there is some type of pattern of the issue, it would be difficult to pin point what may cause the issue.

The best way to resolve this issue is:

  • To impose the unique numbering on task table via a Business rule so that duplicate numbers will not be created. Before every update, it will make sure that a new number is assigned to the record.


OR

  • Enable a unique index on the table.
    Note: While unique indexes ensure data integrity they also prevent any insert involving a duplicate number. This may cause unexpected errors during data entry.


A business rule (run on the server side) that checks for uniqueness on insert is probably the least intrusive option as making the task.number index unique at DB level might have other side effects.

Please Check Enforcing Unique Numbering in product documentation for more information.

 

Let me know guys if you have faced this issue earlier and how did you resolve it?

Please mark this article as Helpful if it helped you.

Cheers,

Hardit Singh

Comments
Kalaiarasan Pus
Giga Sage

The easiest workaround for this in non prod environment is to update 'Numbers' (sys_number) table. The numbers table can be found in left navigation using 'Number Maintenance' module under 'System Definition'.

 

  1. Get the largest number present in the table having the issue.
  2. Locate the record related to your table in 'Numbers' table.
  3. Update the 'Number' column with the latest number from step-1.
Version history
Last update:
‎01-20-2020 11:19 PM
Updated by:
Community Alums