How to overwrite specific template fields?
Generally, template details are a means to override specific fields of a template in order to cover specific use cases.
Default template detail fields
By default, template details include the following fields and, hence, can overwrite the corresponding template fields:
| Field | Type | Notes |
|---|---|---|
| Balance Columns | Text (255) | |
| Balance Types | Long Text Area (32768) | |
| Counter | Text (255) | |
| Custom CSS | Long Text Area (32768) | |
| Display Type | Text (255) | |
| Email Body | Long Text Area (32768) | You must use either Email Body or Email HTML Body in both the template and its associated template details for the overwrite mechanism to work. |
| Email HTML Body | Html (32768) | You must use either Email Body or Email HTML Body in both the template and its associated template details for the overwrite mechanism to work. |
| Email Subject | Text (255) | |
| Info Left | Long Text Area (32768) | |
| Info Right | Long Text Area (32768) | |
| Override Labels | Long Text Area (16384) | |
| PDF Name | Text (255) | The allowed characters include the alphanumeric characters a-z A-Z 0-9 as well as the underscore _ and hyphen - characters. |
| Table Columns | Text (255) | |
| Text 1 | Long Text Area (32768) | |
| Text 2 | Long Text Area (32768) | |
| Text 3 | Long Text Area (32768) |
With standard templates
On a standard template, a template detail affects the PDF through the Override Labels field only. The Liquid file reads all other fields directly from the template, so overwriting them through template details has no effect on the PDF. This includes Text 1, Text 2, Text 3, Table Columns and any custom field you add to the template detail, like the Footer in the examples below. The email texts, the counter and the PDF name are overridden as usual.
Some template fields have no effect on a standard template at all, for example, Balance Columns, Balance Types, Custom CSS, Display Type, Info Left and Info Right. For the complete list, see Standard Template Field Usage.
Certain business use cases require to overwrite or hide template fields that are not covered with template details. To this end, you add new custom fields to the template detail that correspond to the template fields. They must have the same API name – so the template field FieldName__c is FieldName__c on the template detail.
Overwriting Template Field
Assume, for example, you need a dedicated footer for cancellations. The corresponding template field is Footer__c, its data type is Text Area (Long). Here is what you do:
- Navigate to the fields list of the Template Detail object.
-
Create the following new field.
Field Label API Name Data Type Footer Footer Text Area (Long) This makes the
Footerfield available on template details, allowing for overriding the template footer. -
Open the invoice template to be edited.
- In the Template Details section, click Edit in the row of the Cancelation template detail.
- In the
Footerfield, specify the information as necessary. -
Click Save.
This overwrites the template footer when producing cancellations.
Info
Your template details for other use cases, like credits or statements, now also include the Footer field. But as long as you leave it empty, JustOn uses the value as defined in the parent template.
Hiding Template Field
If a template detail field is empty, JustOn uses the value as defined in the parent template. The value n/a in a template detail field will produce an empty (and therefore "invisible") field without falling back to the value set in the template.
Assume you do not want any footer to be printed on PDF files for account statements:
- Open the invoice template to be edited.
- In the Template Details section, click Edit in the row of the Account Statement template detail.
- In the
Footerfield, entern/a. -
Click Save.
This produces an empty, and therefore "invisible",
Footerfield.