Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to create auto-generated numbers for a catalog item based on Fiscal Years

Nicholas Hromya
Giga Guru

 

Hello all,

 

I have a requirement to create auto-generated numbers for a catalog item based on Fiscal Years.

Our fiscal year starts in July.  Hence, I want these auto-generated numbers to update on July 1 of each year. 

So when the numbering starts with 25, that means it will be fiscal year 25/26 July 1, 2025 (already in past) and end June 30 2026.  Then 26 will be fiscal year 26/27 starting July 1 2026 and end June 30 2027.

I hope this makes sense.

 

The expectation is format example below:
25-50000
25-50001

26-60000
26-60001

27-70000
27-70001

 

 

It seems like I could manually create this for each fiscal year (using the Numbers), but I don't want to do this every fiscal year.  

It also seems like I could use the Fiscal Periods to set these up, but I am not sure how to use or otherwise integrate the fiscal periods to auto-generate these.

 

Seems like there is a better solution.  

Maybe some sort of onLoad script?

5 REPLIES 5

DeepthiR4728719
Tera Expert

Hello @Nicholas Hromya 

 

Are these requirements for RITM numbering, or is there a custom field on the form that needs to be populated with these numbers?

If my answer helped in resolving the requirement, please mark it helpful.
Deepthi R. ServiceNow Technical SME

It wasn't clear at first, but now I know it is for a variable (custom field) in a catalog item.  

To achieve auto-generated numbering for ServiceNow Catalog Items based on Fiscal Year, we can implement this using a combination of Number Maintenance + Script Include to get Fiscal Year + Business Rule (before insert) on sc_cat_item table.

If my answer helped in resolving the requirement, please mark it helpful.
Deepthi R. ServiceNow Technical SME

Ken tang
Kilo Sage

Yeah so the sys_number table isn't going to cut it for this out of the box. It gives you one sequence per table with a static prefix, so the 25-, 26-, 27- rotation isn't something you can configure in Number Maintenance without touching it manually each year. Which is exactly what you're trying to avoid.

 

The approach I'd go with: skip fiscal periods entirely (they're for financial reporting, not numbering), and generate the number yourself in a before-insert business rule on sc_request or sc_req_item (whichever table your catalog item produces).

 

Here's the general shape of the logic:

  • Calculate the fiscal year: if current month >= 7, FY = last 2 digits of current year. If month < 7, FY = last 2 digits of current year - 1. So in January 2026 you get 25, in August 2026 you get 26.
  • Store your per-FY counter in a custom table (or a system property scoped per FY, though a table is cleaner). Something like u_fy_number_sequence with fields for fiscal_year and current_counter.
  • On each new request, grab the current counter for that FY, increment it, write it back, and concatenate it: FY + "-" + counter.

That custom table is what handles the "auto-create the new year's sequence" part. First submission in FY26? No row exists yet, so create it starting at your initial value (60000 or whatever). No manual intervention needed ever again.

 

One thing worth noting: do the increment and write-back carefully or you'll hit race conditions if multiple people submit at the same time. For low-volume orgs it's usually fine, but worth being aware of.

 

The onLoad client script idea won't work here since number generation needs to be server-side to be reliable. Business rule on insert is the right place.