- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 02-27-2023 08:19 AM
NOTE: MY POSTINGS REFLECT MY OWN VIEWS AND DO NOT NECESSARILY REPRESENT THE VIEWS OF MY EMPLOYER, ACCENTURE.
This is a quick item that came up recently that I thought would be useful to others. When you define a new table in ServiceNow, you have the option to have it auto-number the records.
By choosing to auto-number, you can define a prefix, a starting number, and a number length.
If you are extending an existing table, for example Incident, you have two options. You can define a custom numbering scheme for your custom table or you can inherit the numbering from the parent. In the case of the former, you would check off Auto-number and define the remaining attributes. In the case of the latter, you would leave Auto-number unchecked and the table would inherit from the Incident table definition (or the numbering definition of the table you extended).
When auto-numbering is turned on, there are two tables used to control the numbering behavior.
- Number (sys_number): This table captures the table, prefix, starting number, and number of digits. Table records (sys_db_object) reference this record in number_ref.
- Number Counter (sys_number_counter): This table captures the current number the table is at. The record is incremented each time a record using that number is created.
If auto-numbering is not turned on for your table, records will not be created for your table. So, if you looked at the table number_ref field, you would not see a value.
When you are defining custom tables, it is important to consider if the table will inherit numbering from a table it extends. If it will, do you need this custom table to have unique numbering or can it inherit from the table it extends? If it will not, do you want auto-numbering on this table; will that be useful to users of the system?
If, by chance, you end up in a situation where you have a table that auto-numbering was turned on for and you now want to turn that off (either because it doesn't need it or because you want it to inherit numbering from the parent), the solution is simple. I did do some research into this and did find this knowledge article from ServiceNow. However, if I only removed the Number Counter record, it was just getting recreated when a new record was created. I tried a number of other solutions to no avail.
In the end, it was the simplest solution that worked. Delete both the Number and Number Counter record for your custom table and the numbering will either stop or start inheriting from the table it extends.
If you find this article helps you, don't forget to log in, bookmark it and mark the article as "Helpful"!
Don't Forget the ServiceNow User Groups! Sign up and attend one near you!
- 9,768 Views

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thank you for filling in this missing piece of documentation! Very interesting.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Great article. I liked the helpful decision presented: "Delete both the Number and Number Counter record for your custom table and the numbering will either stop or start inheriting from the table it extends"; especially for the custom table inheritance to work correctly - great advice.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
When form is new and reload the form then number move to next. i want the form is new with same number.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@GURU3345
This might be helpful for your requirement.
Prevent numbering gaps (servicenow.com)
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
If there is no record created in the table, then how we can get the current number or next number, if we want it in the script include?