Counters and Number Ranges

← Invoice Management

Invoices, credits, cancellations and dunning reminders must have unique numbers to comply with legal regulations. In Draft status, these numbers are temporary and of no legal relevance. When finalizing invoices or dunning reminders, however, JustOn creates the unique and unalterable numbers based on defined counters.


Invoice numbers must be unique and unalterable in order to clearly and unambiguously identify an invoice once it is finalized, that is, effective in legal and bookkeeping terms. Applying JustOn's counter and number range functionality, you make sure that these requirements are met.

The fact that some jurisdictions demand sequential invoice numbers, however, does not imply that your invoice numbers must necessarily be consecutive and without gaps in numbering – solely the uniqueness is required. As long as you can provide an explanation for non-consecutive numbers (like a specifically configured counter or just a canceled invoice), breaks in sequence are acceptable. For Germany, for example, the Sales Tax Application Decree states that a gapless sequence of issued invoice numbers is not mandatory ("Umsatzsteuer-Anwendungserlass", section 14.5).

Depending on your organization's requirements, you must create individual counters for business entities or for invoices, credits, cancellations or dunning reminders via corresponding templates.

Counter and Number Range Implementation

The following concepts are important:

Custom setting that defines how the unique numbers for invoices, dunning reminders, subscriptions or SEPA mandate references are produced, including the pattern, reset interval, etc., see Counters
Number range
JustOn object whose records represent the groups of produced unique numbers for invoices, dunning reminders, subscriptions or SEPA mandate references, see Number Ranges


JustOn implements counters using the custom setting Counters. The following fields are available:

Field Possible Values Description
Name Specifies the name of the counter, is to be referred to by the template.
Defines the interval after which the counter is reset. If empty, the counter is not reset.
Some legal or fiscal systems do not allow invoice number ranges to restart on a monthly or daily base (for example, in France). Make sure you clarify this question before operating in a new market.
Template [Year]
Specifies the pattern of the produced number. It may contain custom placeholders (defined for fields on the invoice, account, subscription, business entity, related invoice and email contact), and must define the minimum number of digits like {00000}. You can combine the placeholders and add any fix strings as necessary.
Use Account Counters (checkbox) true
If checked, creates a new number range for each account that uses this counter.
Start Count Optionally, specifies a start count. If set, the associated number range will start with the next number (<value> + 1). That is, if you want the number range to start with 5, the start count value must be 4.
JustOn evaluates the start count on number range creation and after reset.
If empty, defaults to 0.
If you need the start count for a specific period (→ reset period) only, make sure to delete it after the first unique numbers in the relevant period have been produced.

The Default counter as shipped with JustOn, for example, uses the following pattern template:


This produces invoice numbers of the following pattern:

201700001, 201700002, 201700003

The count increases each time an invoice is set Open and a new invoice ID is created.

The following table lists some examples.

Example Counter Template
2018-Jan-00001 [Year]-[Month]-{00000}
180100001 [Year:yy][Month:MM]{00000}
2018ACME00001 [Year][AccountAccountName]{00000}

By default, JustOn provides the following counters:

  • Default: A single counter used by default for generating all invoice, credit, cancellation or dunning numbers. This counter is assigned to the default invoice template.

    If you have more than one template or template details to cover specific needs, you can use an individual counter with each template or template detail. To this end, configure additional counters. If you use the dunning functionality, for example, configure a dunning counter first and assign it to the corresponding template detail.

    If the template or template detail does not define a counter, JustOn falls back to the counter set on the business entity. If the system cannot find a valid counter, it shows an exception.

  • Dunning Run: Used to count the individual dunning runs. The dunning run counter does not offer the reset feature and does not work with placeholders.

  • Subscription: Used to count the subscriptions. The subscription counter does not offer the reset feature and supports only a limited set of placeholders (account-related and built-in).

Number Ranges

Each counter is associated to one or more number ranges. Number ranges are implemented as a custom object. They represent the groups of numbers to which the unique numbers created for an invoice, dunning reminder etc. belong. If a number range as required by the counter does not exist, JustOn creates one automatically with the count set 0.

With the counter field Reset set to YEARLY, JustOn creates a new number range for each year. Likewise it creates a new number range for each month if Reset is set MONTHLY, and every day if Reset is set DAILY. The reset feature can be combined with the setting Use Account Counters.

JustOn selects number ranges based on the counter defined for the invoice, the account of the invoice and the invoice date for day/month/year.

Number ranges include the following fields:

Field Description
Counter Name Specifies the name of the associated counter.
Counter Shows the current count for this number range. Equals the last produced unique number for an invoice, dunning reminder, subscription or SEPA mandate reference using the associated counter.
Year Shows the year for this number range. Is empty if the counter is set to not reset.
Month Shows the month for this number range. Is empty if the counter is set to not reset or set to reset YEARLY.
Day Shows the day for this number range. Is empty if the counter is set to not reset or set to reset YEARLY or MONTHLY.
Account Shows the account for this number range. Is empty if the checkbox Use Account Counters on the counter is not selected.

Counters and Number Ranges

Number Range History

In case of issues or disputes with respect to the sequence of JustOn's numbering, you may may need some detailed tracking or debugging information about the number range usage. To this end, JustOn introduces dedicated history fields and history tracking for number ranges.


The number range history is available as of JustOn 2.64.

For each generated number, the following information is recorded:

Field Description
Counter The current count for this number range.
Timestamp The date and time of the latest count increase.
Target ID The Salesforce ID of the record on which the counter has been used the last time.
Last Generated Name The last produced counter (invoice number, etc.)

In addition, each history record includes

  • The name of the user who triggered the counter generation
  • The last value and the current value for Counter, Timestamp, Target ID and Last Generated Name.

Enabling Number Range History