The number maintenance module allows you to manage all of the numbering for the various tables within ServiceNow. Record numbering really isn’t that difficult to deal with and its very simple to understand as long as you get it set up before the table has records in it. If you have a table with a bunch of data already and you want to assign numbers or IDs to the records in that table, then you need to run a script to assign numbers to all of the existing records along with the typical number maintenance setup. This article explains how to set this up. Thanks to Matt Gaide and Paul Murphy for the script and article idea!
1 Create a new field to store the number or ID
2 Create a new ‘Number Maintenance’ record
3 Run the Script
Navigate to ‘System Definition -> Scripts – Background’ and paste and run the following script.
rec.u_number = new NumberManager(rec.sys_meta.name).getNextObjNumberPadded();
rec.setWorkflow(false); //Do not run business rules
rec.autoSysFields(false); //Do not update system fields