Template v1 Concepts
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.
Version 1 of JustOn's PDF template mechanism is based on Salesforce's built-in Visualforce PDF rendering. JustOn provides a default template and a number of template details, based on which you can define your own templates.
The template is composed of a number of pre-defined containers that represent specific areas of the page – the header, footer, the invoice line item table, etc. Each container comprises text blocks that define the actual content displayed in the final document. For example, the header container contains text blocks for including addresses for sender and recipient, a company logo, and other invoice details.
Text blocks can include placeholders. These are symbols for fields of Salesforce or JustOn objects (like address fields or payment data), which are to be replaced with actual values upon PDF rendering.
When creating a PDF copy of an invoice, JustOn executes the following internal steps:
- JustOn produces an intermediate HTML document based on the invoice template and using the data provided by the actual invoice.
- The HTML document is then converted into a PDF using standard Salesforce functionality.
The template defines the structure and layout of the intermediary HTML document. That is, when customizing the template, you actually edit an HTML document.
For details about the template structure, building blocks, etc., see Default Template.
Usually, you have multiple templates that each serve a specific target. There are, basically, two ways to diversify templates:
- 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.
You can combine the two approaches.
Template details are a means to override specific fields of a parent template in order to cover specific use cases. Together with the default template, JustOn ships template details for 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 (
Cancelation in case of invoices).
If there is no specific template detail available for a certain use case, like dunning, for example, JustOn 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.
When setting up a Subscription, Opportunity or any other object for billing, you usually specify a standard template for that object. This template is then assigned by default to all invoices created from that object.
If the source record does not specify a template, JustOn uses the one set on the related account. In case the account has not set a template either, JustOn falls back to the
As long as an invoice has the status
Draft, you can assign another template to the invoice.