- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 08:12 AM
Hey all,
There has to be someone out there that has done this, it seems fairly straight forward, but eludes this guy!
I have a custom table, requiring custom auto numbering. Basically "Current year - incremented #".
However, I need to automatically reset the incremented # when the current year changes.
The incremented # is the table auto num with no prefix, so that might add another level, maybe not.
Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 08:19 AM
Hi Wade,
Keep track of your record number in a separate table. You COULD use the sys_number_counter table.
Write yourself a script that gets that number and prefixes with the current year. E.g. 20170001.
Write a BR that runs on query of that table so each time it reads, it first checks if the year has changed and number needs to be reset. If so, update the number and continue to read the new values going forward. GlideDate() is going to come in to play here.
Reference:
Business Rules - ServiceNow Wiki
Business Rules Best Practices - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 08:19 AM
Hi Wade,
Keep track of your record number in a separate table. You COULD use the sys_number_counter table.
Write yourself a script that gets that number and prefixes with the current year. E.g. 20170001.
Write a BR that runs on query of that table so each time it reads, it first checks if the year has changed and number needs to be reset. If so, update the number and continue to read the new values going forward. GlideDate() is going to come in to play here.
Reference:
Business Rules - ServiceNow Wiki
Business Rules Best Practices - ServiceNow Wiki