Counters and Number Ranges
Invoices, credits, cancellations and dunnings 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 finishing dunnings, 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:
|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.|
||Specifies the pattern of the produced number. It may contain all custom placeholders, like
|Use Account Counters (checkbox)||
||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:
2017-00001, 2017-00002, 2017-00003
The counter is incremented each time an invoice is set
Open and a new invoice ID is created.
Each counter is associated to one or more number ranges. If a number range does not exist, JustOn creates one automatically with the counter set
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 of the invoice, the account of the invoice and the invoice date for day/month/year.
Number ranges are implemented as a custom object. The following fields are available:
|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
|Day||Shows the day for this number range. Is empty if the counter is set to not reset or set to reset
|Account||Shows the account for this number range. Is empty if the counter setting Use Account Counters is unchecked.|
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).
Creating New Counter
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.
To create a new counter:
In Setup, open Custom Settings.
In Salesforce Lightning, navigate to Custom Code > Custom Settings.
In Salesforce Classic, navigate to Develop > Custom Settings.
Click Manage in the row of Counters.
- Click New.
Specify the details as necessary.
The mandatory information include the name and template. Set the reset interval and the account counter option as necessary.