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:
|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 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
|Use Account Counters (checkbox)||
||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 (
JustOn evaluates the start count on number range creation and after reset.
If empty, defaults to
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.
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
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:
|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 checkbox
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 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).
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
Templateof 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 Countersof the counter unselected.
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 fields include
Use Account Countersor
Start Countas necessary.
Modifying existing counters immediately affects the current numbering.