Standard Template 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.

The standard version 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.

Template Structure

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.

Template Variation

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 (Credit or 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.

Template Assignment

This is how JustOn Billing & Invoice Management looks for a template:

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.


As long as an invoice has the status Draft, you can assign another template to the invoice.