Working With Templates
The template is the model based on which the PDF copy of an invoice, dunning reminder or account statement is rendered. It defines its contents and layout. Produced PDF documents are intended to be distributed via email or postal service to customers, and can be exported and archived.
Combining data with a template to produce an output
In addition to the fields that are printed to the PDF, the templates also include texts for the email that JustOn sends to distribute the rendered PDF documents.
Standard and Classic Templates
JustOn Billing & Invoice Management supports two kinds of templates. Which one you use determines how the PDF is produced, how much control you have over the result, and which features are available.
- Standard template
-
The PDF is produced by the JustOn PDF service. A Liquid file, attached to the template record, defines the whole document – structure, tables, styling and page layout. The template record supplies the texts and some formatting settings.
Standard templates produce archivable PDF/A output, give you full control over the layout, and support the complete feature set, including ZUGFeRD/Factur-X e-invoices as well as partial invoices and progress invoices, none of which can be produced any other way.
For concepts and implementation details, see Standard Template Concepts.
- Classic template
-
The PDF is produced by Salesforce's built-in Visualforce PDF rendering. Here the template record itself defines the document: pre-defined containers hold text blocks, which you fill and arrange using template fields.
Classic templates are easy to handle without expert knowledge – no web development skills are required. In exchange, the document follows a fixed structure, some features are unavailable, and the Visualforce PDF rendering limitations apply.
For concepts and implementation details, see Classic Template Concepts.
Info
As of v2.121, the standard template is what JustOn Billing & Invoice Management creates by default. Clicking New on the Templates tab produces a template record that is already prepared for the JustOn PDF service, with a Liquid file attached and the language of your choice applied.
Classic templates remain fully supported. To create one, use the Classic Template link at the bottom of the same dialog.
What the Liquid file does
The Liquid file takes the place of the layout model that is built into Salesforce. Instead of filling containers that the software has laid out for you, the file itself iterates over the invoice data and lays out the document – which tables exist, which columns they have, how sections break across pages, what everything looks like.
That is where the additional control comes from, and also the additional responsibility: changing the layout of a standard template means editing the Liquid file, not the template record.
The Liquid file that JustOn Billing & Invoice Management delivers is part of the product and is supported as such. Once you modify it, you are doing custom development: this requires profound skills in web development techniques, in particular, the Liquid template language and Cascading Style Sheets (CSS). Issues arising from your own modifications may not be covered by the general maintenance and support contract for JustOn Billing & Invoice Management.
Feature Coverage
| Document or Feature | Standard Template | Classic Template |
|---|---|---|
| Invoices, credits, cancellations, pro forma, deposit | ||
| Dunning reminders | ||
| Account statements | ||
| Partial invoices, progress invoices and final invoices | ||
| ZUGFeRD/Factur-X e-invoices | ||
| Archivable PDF/A output | ||
| SEPA credit transfer QR codes | ||
| Payment page QR codes | ||
| Swiss QR-bill |
Info
Existing Liquid files for dunning reminders, account statements and Swiss QR code invoices keep working with the rendering engine v2.
Template Assignment
This is how JustOn Billing & Invoice Management looks for a template – irrespective of the template type:
ON_Template field on the invoice source records
↳ ON_Template field on the account
↳ Template field on the business entity
↳ Default template
(1) To predefine a specific template for your standard use cases, you usually set it via the ON field ON_Template on your source records for the invoice generation.
Generally, ON_Template is a formula field. In the simplest use case, you just name the template to use. If necessary, however, you use a formula that returns a dedicated template according to your specific criteria – target region, business entity, product group, etc.
(2) As a more general setting, you can define a dedicated template per customer – using an ON_Template field on the account. If the source record does not specify a template, JustOn uses the one set on the account.
(3) In addition, you can set a template per business entity. If there is no template defined on the source record or the account, it is retrieved from the Template field on the business entity that is related to the target record (invoice or statement).
(4) If neither the source record, the account nor the business entity specify a template to use, JustOn Billing & Invoice Management falls back to the Default template. Note that you can leave the Default template shipped with the package untouched and use this as your fallback, or create a custom template according to your needs and name it Default.
Info
As long as an invoice has the status Draft, you can assign another template to the invoice.
Template Variation
Usually, you have multiple templates that each serve a specific target. In order to diversify templates, there are two approaches that you typically combine:
- Creating multiple templates for different targets, for example, different locales or specific customer groups,
- Using both dedicated Liquid files (attachments to the template record) to customize specific parts of the resulting PDF files for different purposes, for example, invoice, credit, cancellation, and dedicated template details to customize email texts or counters for specific purposes
JustOn Billing & Invoice Management attaches a default Liquid file to standard templates for invoices, credits and cancellations. For dunning reminders and account statements as well as for Swiss QR-code invoices, there are Liquid files that work with the rendering engine v2.
- Creating multiple templates for different targets, for example, different locales or specific customer groups
- Using template details to customize specific parts for different purposes, for example, invoice, credit, cancellation.
Based on these files, you define your own PDF document models.
Template Details
Template details are a means to override specific fields of a parent template in order to cover specific use cases, like credits, cancellations, dunning reminders, and account statements. These template details overwrite certain fields of the parent template depending on the object (Invoice or Statement) and the object type (Credit or Cancelation in case of invoices).
The applicable template details are determined by the document being produced:
| Use Case | Template Detail |
|---|---|
| Invoice | none – the template record itself is used |
| Credit | Credit |
| Cancellation | Cancelation |
| Dunning reminder | Dunning |
| Account statement | Account Statement |
Note
If there is no specific template detail available for a certain use case, like dunning, for example, JustOn Billing & Invoice Management uses the information as defined in the corresponding invoice template, including the defined text blocks, the counter, etc.
For information about using template details, see Configuring Template Details.
Data Origin
Depending on the use case, JustOn Billing & Invoice Management assembles the PDF file and the email from up to three sources. The only difference between the two types of templates is where the layout comes from:
| Data Category | Standard Template | Classic Template |
|---|---|---|
| PDF layout and structure | Liquid file | Template record |
| Labels and free-text blocks | Template record | Template record |
| Email standard texts | Template record or template detail record | Template record or template detail record |
| Counter1 | Template record or template detail record | Template record or template detail record |
-
For credits and cancellations, a separate counter is optional – without one, the invoice counter applies. ↩