Number Template Definitions
A number template defines how the system generates codes and document numbers automatically, for example ACC00001 for accounts or WOR00042 for work orders. A template combines fixed text, an optional dynamic part such as the current year, and a counter that increases each time a number is issued.
Number templates are maintained under Organizational Setup > Number Templates. Every record type that supports automatic numbering is linked to its template through the template's Default Usage Target.
Purposes of Number Templates
- Giving every record type consistent, readable codes without typing them by hand.
- Preventing duplicate codes: the system skips numbers that are already used.
- Adapting the numbering format to the organization's conventions (prefix, number of digits, yearly restart, and so on).
- Continuing numbering correctly after data has been imported from Excel.
How Numbers Are Generated
Where Generated Numbers Are Used
- Code fields: On definition pages whose record type has a default number template, a button with a numbers icon is shown next to the Code field. Clicking it fills the field with the next free code from the template. The button is shown only when a template exists for the record type.
- Empty codes: On some screens (for example process definitions) and in Excel imports, a record saved with an empty code receives the next code from the template automatically.
When the system issues a code, it checks whether the code is already used by an existing record. If it is, the counter is advanced until a free code is found (up to 50 attempts).
Template Syntax
The Template field is a text with placeholders written in double curly braces:
{{counter}}- required. The position of the counter. A template without it would give every record the same code, so the system refuses to generate a code from such a template.- Fixed text - any letters, digits or separators, for example
ACC,WO-or/. - Template expressions - the template is processed by a text template engine, so expressions such as the current date can be used, for example
{{ date.now | date.to_string '%Y' }}for the current year.
Examples (with counter text width 5 and padding character 0):
| Template | Generated numbers |
|---|---|
ACC{{counter}} | ACC00001, ACC00002, ... |
WO-{{ date.now | date.to_string '%Y' }}-{{counter}} | WO-2026-00001, WO-2026-00002, ... and WO-2027-00001 in the next year |
Counter and Number Sequences
The counter is kept separately for each group key. The group key is the generated text without the counter, for example ACC or WO-2026-. As a result:
- A template with only fixed text has a single, continuous counter.
- A template that contains the year starts a new sequence (and restarts the counter) when the year changes.
The counter is calculated as follows:
- The first number of a group is Counter Start Value + Counter Increment Value (for example 0 + 1 = 1).
- Each further number adds Counter Increment Value to the last issued value.
- The counter is written with at least Counter Text Width characters, padded on the left with the Counter Padding Character (for example width 5 and
0gives00001).
The default templates created by the system use start value 0, increment 1, width 5 and padding character 0, with a three-letter prefix per record type (for example ACC for accounts, BRD for brands, LOC for locations, MSU for measurement units).
When records with codes that follow the template are imported from Excel, the counter is raised to at least the highest imported number so that the next generated code continues after them.
Number Template Operations
The number template listing and registration pages provide standard functions such as exporting to Excel, filtering, and customizing field visibility. These functionalities are detailed under General System Usage.
The list shows the code, name, template, counter settings and default usage target of each template. From a row you can Edit or Delete a template or generate a report (Reports).
Number Template Definition Page
- Code: The unique code of the template, required, at most 100 characters.
- Name: The name of the template, required, at most 255 characters.
- Template: The numbering format (see Template Syntax), required, at most 300 characters.
- Counter Start Value: The value the counter starts from; the first number is start value + increment. Minimum 0. Optional (0 when empty).
- Counter Increment Value: The amount added to the counter for each new number. Minimum 0. Optional (1 when empty).
- Default Usage Target: The record type (for example Account, Asset, Work Order) whose codes are generated from this template. Select from the list of record types that support numbering. Optional.
- Counter Text Width: The minimum number of characters of the counter. Optional; when empty the counter is written without padding.
- Counter Padding Character: A single character used to pad the counter to the text width. Optional (
0when empty). - Description: Additional details, optional, at most 500 characters.
Number Sequences: This tab lists the counters of the template, one line per group key:
- Group Key: The generated text without the counter (for example
ACC), required, at most 500 characters. - Counter Value: The last issued counter value of that group, required, minimum 0.
You can add a line or change a counter value here, for example to continue the numbering from an existing system. The next number of the group will be the counter value plus the increment.
Authorization and Access Control
Topics related to authorization and access control are detailed under User Management and Authorization.
The following permissions are defined in the Infrastructure permission group:
- Number Template: Opens the Number Templates menu and allows viewing templates. This permission is also required to use the code generation button on other pages.
- Create New Number Template: Create new number templates.
- Update a Number Template: Edit templates, change counters and usage targets.
- Delete a Number Template: Delete templates.
- Number Generator Batch Operations: Export and list report operations.
- Design a Number Template: Design (customize) the related pages.
Warnings and Error Messages
- Unique Code: A template cannot be saved with a code that already exists.
- Mandatory Fields: Code, Name and Template are required.
- Missing Counter: "The number template must carry the counter placeholder; without it every record would be given the same code."
- No Template: "No number template is defined for this list, so a code cannot be issued." No template has the record type as its default usage target.
- Counter Behind the Data: "The code sequence has fallen behind the data - no number it produces is still free. Reset the counter on the number template." Increase the counter value on the Number Sequences tab past the highest code in use.
- Invalid Values: Counter start, increment, width and sequence counter values cannot be negative; the padding character can be only one character.
User Tips and Best Practices
- One Template per Record Type: Assign each default usage target to only one template so it is clear which format is used.
- Do Not Lower Counters: Lowering a counter below codes already in use makes the system skip many numbers or report that the sequence has fallen behind.
- Plan the Width: Choose a counter text width large enough for the expected number of records so that codes sort correctly.
- Use the Year for Documents: For transactional records, including the year in the template gives yearly numbering automatically.
Frequently Asked Questions
Why Is There No Generate Button Next to the Code Field?
No number template has that record type as its Default Usage Target, or you do not have the Number Template permission.
How Do I Restart Numbering Every Year?
Include the year in the template, for example WO-{{ date.now | date.to_string '%Y' }}-{{counter}}. Each year creates a new group key with its own counter.
How Do I Continue Numbering from Our Old System?
Open the template, go to Number Sequences and set the Counter Value of the group key to the last number used in the old system.
What Happens If I Type a Code by Hand?
The code is saved as typed and the counter does not change. If the code matches the template, a later generated code that would collide with it is skipped automatically.