- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 12:46 AM
Hii, I have created a number maintenance on user (sys_user) table. When I create new a user record the number is working fine but its not showing numbers in already existing records. how can I show the number in already existing records?
Thanks in Advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 12:54 AM
@Gaurav69 You need to use a fix script to populate numbers on the existing records use
getNextObjNumberPadded();
to generate number for your existing records in a fix script.
Please refer to this link for more information https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/administer/field-admini...
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 12:54 AM
@Gaurav69 You need to use a fix script to populate numbers on the existing records use
getNextObjNumberPadded();
to generate number for your existing records in a fix script.
Please refer to this link for more information https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/administer/field-admini...
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 04:34 AM
Hii Sandeep, Thank you so much for the solution. Can you help me with the Script also if possible.
Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 05:30 AM
@Gaurav69 Here is the sample script for you.
var glideUser = new GlideRecord('sys_user');
glideUser.addEncodedQuery('number=NULL'); //Replace number with the name of your number field
glideUser.query();
while (glideUser.next()) {
var numMgr = new NumberManager('sys_user');
var newNum = numMgr.getNextObjNumberPadded();
glideUser.setValue('number',newNum);//Replace number with the name of your number field
glideUser.update();
}
Caution: Please do not run this script in production directly. Run this script in a sandbox/non-prod instance with a single record first (use if instead of while). Verify, if it works well then proceed with the other instances.
Please mark the response helpful and accepted solution if it manages to address your question.