Counters and Number Ranges

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.

Counter and number range concepts

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.
Template [Year]
Specifies the pattern of the produced number. It may contain custom placeholders (defined for fields on the invoice, account, subscription, tenant, 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.

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.

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.


Your business may require to start your invoices count with a given number. To this end, you create a number range for invoices that defines the intended start count before actually generating and finalizing invoices.

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 number of the last invoice.
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.

By default, JustOn provides the following counters:

  • Default: A single counter used by default for generating all invoice, credit, cancellation or dunning IDs. 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 tenant. 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).

Depending on your organization's requirements, you must create individual counters for invoices, credits, cancellations or dunning reminders. They are then to be assigned to the corresponding template or template detail.


When defining counters, be aware of the following considerations:

  • Special characters like -, ;, : etc. are likely to be removed from the reference string upon transaction processing by the banks. JustOn therefore recommends not to include these characters when defining the number pattern for the produced invoices in the field Template of the counter.
  • Account counters consume additional storage space in your org and may become difficult to handle with large numbers of accounts. JustOn therefore recommends to avoid using account counters, leaving the checkbox Use Account Counters of the counter unselected.

To create a new counter:

  1. In Setup, open Custom Settings.

    In Salesforce Lightning, navigate to Custom Code > Custom Settings.

    In Salesforce Classic, navigate to Develop > Custom Settings.

  2. Click Manage in the row of Counters.

  3. Click New.
  4. Specify the details as necessary.

    The mandatory information include the name and template. Set the reset interval and the account counter option as necessary.

  5. Click Save.

    This creates the new counter and makes it available in templates and template details.