action.skip

Standard Template Advanced Options

← Configuring PDF Creation

Depending on your custom requirements, additional tasks with respect to standard templates can involve:

Info

For topics beyond the scope of the usual template configuration, refer to Template CSS and the FAQ section PDF and Email.

For further help with template customization, contact JustOn Support.

Configuring Overrides

Depending on your organization's requirements, you must modify some labels or the number of decimal places that are to be printed on the invoice PDF. To do so, you configure override labels and decimal places in the corresponding template fields.

Configuring Override Labels

The template field Override Labels allows to define a new label for individual fields. The setting accepts all objects (standard, custom and JustOn objects) and fields. It therefore applies to all placeholder fields as well as fields in the line item table and the transaction table.

The field value is in JSON notation and has the following syntax:

{
  "ObjectApiName" : { "FieldApiName" : "Label" }
}

To define, for example, new labels for some invoice line item and invoice fields, use:

{
    "InvoiceLineItem__c": {
        "Title__c": "Product Name",
        "UnitPriceCalc__c": "Price"
    },
    "Invoice__c": {
        "GrandTotal__c": "Invoice Total"
    }
}

A number of generic labels do not originate from fields. They can still be changed specifying them as Calculated:

{
    "Calculated": {
        "PosNo": "Position",
        "Subtotal": "Subtotal"
    }
}
Template Area Generic Label Designation Default Value
Page counter PageLabel Page
OfLabel of
Invoice line item table PosNo Pos.
Subtotal section SubTotalNetNoDiscount Subtotal (net)
SubTotalNetDiscounted Subtotal (discounted)
SubTotalDiscount Order Discount ([OrderDiscount])
SubTotalNet Subtotal (net)
SubTotalGross Subtotal (gross)
Total section Subtotal Subtotal
PaymentAmount Payment Amount
RefundAmount Refund Amount
RoundingDifference Rounding difference
TotalTax Total Tax
Credit Credit
Local currency table LocalAmount Local Currency
Balance table BalanceTitle Item
AccountBalance Account Balance
Received payments section
(deposit invoicing)
ReceivedPaymentsNet Received Payments (net)
ReceivedPaymentsGross Received Payments (gross)
ReceivedPaymentsTotalTax Tax on Received Payments
ReceivedPaymentsTax Tax on Received Payments ([TaxRate])
Final payments section
(deposit invoicing)
FinalPaymentNet Remaining Final Payment (net)
FinalPaymentGross Remaining Final Payment (gross)
FinalPaymentTax Tax on Remaining Final Payment
Account statement table OpenAmount Open Amount
AmountGT Amount

Info

Labels are rendered in the language of the current user locale. If the language of the template differs from the user language, you need to override the labels for the fields PageLabel and OfLabel to produce a correctly localized invoice PDF.

The following code illustrates an example for German labels that may be used and must be overridden:

{
    "Calculated": {
        "PosNo" : "Pos.",
        "Subtotal" : "Zwischensumme",
        "PaymentAmount" : "Zahlbetrag",
        "RefundAmount" : "Erstattungsbetrag",
        "Credit" : "Gutschrift",
        "RoundingDifference" : "Rundungsdifferenz",
        "AccountBalance" : "Account-Saldo",
        "BalanceTitle" : "Posten",
        "OpenAmount" : "Offener Betrag",
        "SubTotalNet" : "Zwischensumme (netto)",
        "SubTotalGross" : "Zwischensumme (brutto)",
        "PageLabel" : "Seite",
        "OfLabel" : "von"
   }
}

To configure override labels:

  1. Open the template to be edited.
  2. In the Overrides section, click next to the Override Labels field and specify the override definition in JSON as required.

    Alternatively, you can click Edit in the detail view to edit the field.

  3. Click Save.

Configuring Decimal Places

The template field Decimal Places is the most relevant setting to control the number of decimal places to be displayed for individual fields. The setting accepts all objects (standard, custom and JustOn objects) and fields. It therefore applies to all placeholder fields as well as fields in the line item table, the transaction table and the tax breakdown table.

The field value is in JSON notation and has the following syntax:

{
  "ObjectApiName" : { "FieldApiName" : number }
}

To set, for example, the number of displayed decimal places for the price and tax fields of the invoice line item and tax delta to 2 and for the invoice total to 4, use:

{
    "InvoiceLineItem__c": {
        "TaxAmount__c": 2,
        "UnitPrice__c": 2,
        "Quantity__c": 2,
        "PosTotalNet__c": 2
    },
    "TaxDetail__c": {
        "Rate__c": 2
    },
    "Invoice__c": {
        "GrandTotal__c": 4
    }
}

The setting also accepts special fields for calculated values:

{
    "Calculated": {
        "SubTotalTax": 3,
        "SubTotalNet": 2,
        "SubTotalGross": 2
    }
}

To configure the number of decimal places:

  1. Open the template to be edited.
  2. In the Overrides section, click next to the Decimal Places field and specify the definition in JSON as required.

    Alternatively, you can click Edit in the detail view to edit the field.

  3. Click Save.

Info

If there is no definition of decimal places in the template, JustOn falls back to the following settings in this order:

(1) Decimal Places for Unit Price and Decimal Places for Quantity on the invoice line item

(2) Decimal Places for Unit Price and Decimal Places for Quantity in the global settings

(3) Global default: two decimal places for all numeric values

Configuring Page Number Display

Generally, JustOn prints the page number for produced PDF files. The templates by default include the pattern [PageLabel] [PageCounter] [OfLabel] [NumberOfPages] (see Built-In Placeholders) in the field Info Left (hidden on the first page, see PDF Contents). This produces a string like, for example, Page 2 of 4 in the top left corner of the page starting with the second page of a document.

Your business may require to modify the page counter display – move it to another area on the page or change a label. Assume, for example, you want the page counter on the page bottom and "of" replaced with a slash character.

To this end, proceed as follows:

  1. Open the template to be edited.
  2. In the Header & Footer section, delete the string [PageLabel] [PageCounter] [OfLabel] [NumberOfPages] from the Info Left field and insert it in the Footer field.
  3. In the Overrides section, add the following JSON expression to the Override Labels field:

    {
        "Calculated": {
            "OfLabel": "/"
        }
    }
    

Since the footer is printed on every page of the PDF file, the page counter will be visible from page 1, and display like Page 1 / 2 for a two-page document.

Configuring Subtotal Display

Depending on your business requirements, you must display a subtotal after an invoice line item.

Generally, a subtotal section includes a row for the calculated net subtotal, followed by one or more rows for each distinct tax rate. After the last invoice line item, there will be always a subtotal section.

There are two options:

  • Using the checkbox Display Subtotal After on the subscription item or the invoice line item, you can force JustOn to produce a subtotal section after each invoice line item when generating the invoice.
  • You can, however, define a criterion that triggers the subtotal section display, grouping the invoice line items by this criterion at the same time. To do so, use the field Subtotal Criterion on the invoice template: Specify a field of the invoice line item, and each time the contents of the field changes, JustOn produces a subtotal section.

Displaying Grouped Subtotal Section

Subtotal Criterion set to TaxRate__c
Pos Title Unit Price Tax Rate Tax Amount Pos Total Net
1 A 10,00 10% 1,00 10,00
2 B 25,00 10% 2,50 25,00
Subtotal (net) 35,00
Tax (10%) 3,50
3 C 25,00 5% 1,25 25,00
Subtotal (net) 25,00
Tax (5%) 1,25
4 D ... ... ... ...

To set a subtotal criterion:

  1. Open the template to be edited.
  2. In the Line Items section, click next to the Subtotal Criterion field and specify the API name of the invoice line item field you want to use as subtotal criterion.

    Alternatively, you can click Edit in the detail view to edit the field.

  3. Click Save.

Info

You can define a custom formula field on the invoice line item to be used as criterion if you must model complex subtotal criteria.

Displaying Gross Subtotal

You may want to display the gross subtotal, that is, the sum of the net subtotal and the taxes, for each subtotal section.

Subtotal Criteria set to TaxRate__c, including gross subtotal
Pos Title Unit Price Tax Rate Tax Amount Pos Total Net
1 A 10,00 10% 1,00 10,00
2 B 25,00 10% 2,50 25,00
Subtotal (net) 35,00
Tax (10%) 3,50
Subtotal (gross) 38,50
3 C 25,00 5% 1,25 25,00
Subtotal (net) 25,00
Tax (5%) 1,25
Subtotal (gross) 26,25
4 D ... ... ... ...

To enable the gross subtotal display, you add a corresponding CSS rule:

  1. Open the template to be edited.
  2. In the Layout & Design section, click next to the Custom CSS field and specify the following CSS code:

    .invoice-table .subtotal-calculated.gross {
        display: table-row;
    }
    
  3. Click Save.

Overriding Subtotal Labels

Your business may require to customize the labels for the calculated values Subtotal (net) and Subtotal (gross). Depending on your requirements, there are three options to do so:

Modifying Subtotal Custom Labels

You can override the subtotal labels SubTotalGross and SubTotalNet on org level.

Note

To modify custom labels, you must enable the Translation Workbench. For details, see Enable and Disable the Translation Workbench in the Salesforce Help.

  1. Click to enter Setup, then open the Custom Labels list.

    In Salesforce Lightning, navigate to User Interface > Custom Labels.

    In Salesforce Classic, navigate to Create > Custom Labels.

  2. Click the name of the label you want to modify.

  3. Click New Local Translations/Overrides.
  4. Select the target language and specify the text as required.
  5. Click Save.

    This applies the new labels to all invoices generated in your org.

For additional information, see Custom Labels in the Salesforce Help.

Overriding Subtotal Labels per Template

Assume you want to specify new subtotal labels on a template-specific basis, like, for example, Net Subtotal instead of the default Subtotal (net). To do so:

  1. Open the template to be edited.
  2. In the Overrides section, click next to the Override Labels field and specify the override definition in JSON as required.

    {
        "calculated":{
            "SubTotalNet":"Net Subtotal",
            "SubTotalGross":"Gross Subtotal"
        }
    }
    
  3. Click Save.

    This applies the new labels to all invoices based on the current template.

For additional information, see Configuring Override Labels.

Overriding Individual Subtotal Labels

If you display grouped subtotal sections, you can configure individual overrides for the subtotal labels. Basically, you first set empty values by default, then use CSS to apply the individual labels.

Criterion Cause CSS Class Notes
Criterion-based subtotal Criterion is set in the field Subtotal Criterion on the invoice template – each time the contents of the field changes, JustOn produces a subtotal section. .criteria-OLD-NEW OLD and NEW represent the values of the set criterion field, like the tax rate if Subtotal Criteria set to TaxRate__c
To identify the actual CSS classes, use the template debug mode.
End of table To be printed after the last invoice line item .criteria-last
.criteria-last-OLD Append the OLD value with a preceding criterion change (covered with .criteria-OLD-NEW)
Forced subtotal Checkbox Display Subtotal After on the invoice line item is set. .criteria-forced
  1. Open the template to be edited.
  2. In the Overrides section, click next to the Override Labels field and specify empty strings in the override definition in JSON.

    {
        "calculated":{
            "SubTotalNet":"",
            "SubTotalGross":""
        }
    }
    
  3. In the Layout & Design section, click next to the Custom CSS field and specify the CSS code as required.

    Depending on your use case, set .criteria-OLD-NEW, .criteria-last-OLD or .criteria-forced. First hide the default label content, then specify the intended label text in content.

    tr.subtotal-calculated.gross.criteria-19_000-0_000 td.SubTotalGross.label:after  {
        content: "Subtotal for taxable products";
        visibility: visible;
    }
    
    tr.subtotal-calculated.gross.criteria-last-0_000 td.SubTotalGross.label:after  {
        content: "Subtotal for tax-exempt products";
        visibility: visible;
    }
    
  4. Click Save.

    This applies the new labels to the corresponding subtotal sections.

Controlling Subtotal Tax and Subtotal Order Discount Display

By default, JustOn includes the tax information and order discount information in each subtotal section. Depending on your business requirements, however, you can configure JustOn to print a summary of this information for the entire invoice instead of displaying it separately in each subtotal section.

To this end, use the following template fields:

Field Description Default Value
No Subtotal Tax (checkbox) If selected, disables the display of the subtotal tax for each individual subtotal section and prints a tax summary for the entire invoice. false
No Subtotal Discount (checkbox) If selected, disables the display of the subtotal order discount for each individual subtotal section and prints an order discount summary for the entire invoice. false

To configure the subtotal tax display:

  1. Open the template to be edited.
  2. Click Edit in the detail view.
  3. In the Line Items section, select or deselect the checkbox No Subtotal Tax.
  4. Click Save.

To configure the subtotal order discount display:

  1. Open the template to be edited.
  2. Click Edit in the detail view.
  3. In the Line Items section, select or deselect the checkbox No Subtotal Discount.
  4. Click Save.

Displaying Total Net or Total Tax

Your business may require to display the invoice total net or invoice total tax above the grand total. To enable the total net and total tax display, you add a corresponding CSS rule:

  1. Open the template to be edited.
  2. In the Layout & Design section, click next to the Custom CSS field and specify the following CSS code:

    .invoice-table tr.totalNet,
    .invoice-table tr.totalTax {
        display: table-row;
    }
    
  3. Click Save.

Grouping Invoice Line Items by Category

Depending on your business requirements, you may need to group related invoice line items and display a corresponding category header. To this end, use the following template fields:

Field Description
Category Criterion Specifies the invoice line item field that is used as the categorization criterion.
Category Label Specifies the text to be printed as the category header. Can contain placeholders like [ProductGroup] to allow for a category-specific distinction.

When using the category criterion and category label, be aware of the following characteristics:

  • The category header is displayed for each group of invoice line items.
  • If a group of invoice line items is distributed over several subtotal sections, the header is also shown above the first invoice line item after a subtotal section.
  • JustOn does not sort the invoice line items according to the groups. To actually merge invoice line items of one group into one category section on the invoice, you can use the Sequence field.
  • If the Category Label contains a placeholder that refers to a line item field, it refers to the first line item below the header.
  • If the invoice line item field as specified by Category Criterion is empty for the first invoice line item of a group or after a subtotal section, then the category header is not displayed.
Category Criterion set to ProductGroup__c and Category Label set to Group [ProductGroup]
Pos Title Unit Price Tax Rate Tax Amount Pos Total Net
Group G1
1 A 10,00 10% 1,00 10,00
2 B 25,00 10% 2,50 25,00
Group G2
3 C 25,00 10% 2,50 25,00
4 D ... ... ... ...

To configure the invoice line item group display:

  1. Open the template to be edited.
  2. In the Line Items section, click next to the Category Criterion field and specify the API name of the invoice line item field you want to use as category criterion.

    Alternatively, you can click Edit in the detail view to edit the field.

  3. Click next to the Category Label field and specify the text to be printed as the category header.

    The label can contain placeholders like [ProductGroup].

    Alternatively, you can click Edit in the detail view to edit the field.

  4. Click Save.

Info

You can define custom formula fields on the invoice line item to be used as criterion and label if you must model complex category criteria.

Using CSS to Control Output

Certain use cases require multiple templates with only small differences. Multiple templates, however, may become difficult to maintain. This section illustrates some example requirements and shows how to cover them with a single template.

Available Style Classes

JustOn supports specific CSS classes that allow for applying some custom styling to the contents of certain invoice or dunning fields.

CSS classes in the body element of the invoice PDF
Considered Invoice Field Available CSS Classes Notes
Class class-Invoice
class-Credit
Type type-Installment
no-type
Email Invoice is-email-invoice
no-email-invoice
Print Invoice is-print-invoice
no-print-invoice
Business Entity business-entity-<Company_Name>
no-business-entity
The business entity class name is composed of business-entity- and the name of the business entity, where the allowed characters include a–z, A–Z, 0–9, and underscore (_). That is, you must replace dots, commas or spaces with underscores, and special characters with their nearest ASCII neighbor.
For compatibility reasons, JustOn supports the business entity-specific CSS class names that use tenant, like no-tenant.
CSS classes in the body element of the dunning PDF
Considered Dunning Field Available CSS Classes Notes
Level level-1
Email Dunning is-email-dunning
no-email-dunning
Print Dunning is-print-dunning
no-print-dunning
Business Entity business-entity-<Company_Name>
no-business-entity
The business-entity class name is composed of business-entity- and the name of the business-entity, where the allowed characters include a–z, A–Z, 0–9, and underscore (_). That is, you must replace dots, commas or spaces with underscores, and special characters with their nearest ASCII neighbor.
For compatibility reasons, JustOn supports the business entity-specific CSS class names that use tenant, like no-tenant.

You can define the field AdditionalStyleClass on the invoice or dunning. Its content will be normalized and added as an additional style class to the body element. Use this field to consider the values of further invoice or dunning fields to be styled using CSS.

Depending on your business, you may decide on a per customer basis whether to email PDF documents or to post hard copies. To this end, you can mark invoices using the Email Invoice or Print Invoice checkboxes.

Now assume that you print invoices or statements on your company stationery, which already includes all relevant company information and design elements. In this case, you hide the header, footer and logo.

  1. Open the template to be edited.
  2. In the Layout & Design section, click next to the Custom CSS field and specify the following CSS code:

    .is-print-invoice .page-footer, .is-print-invoice .page-header, .is-print-invoice .header, .is-print-invoice .logo {
        display: none;
    }
    
  3. Click Save.

    This suppresses the header, footer and logo if the invoice is marked as Print Invoice.

If you work with business entities, you can apply individual company information for them.

The following example assumes that you have two business entities:

  • Business Entity 1: AMERICA
  • Business Entity 2: EUROPE

You want to use business entity-specific logos and footers, whereas the other information (like invoice texts and table configurations) remain the same. Implementing this example involves three steps:

Adding Business Entity-Specific Logos

You can add the two logos using the image-by-ID mechanism (as mentioned in Handling Multiple Images) to a text building block like Header or Info Left.

Info

Following the example, the images are moved using the position CSS declaration, so you can use any generic text container to hold the image references.

Assuming the image IDs are 50130000000014A (logo for Business Entity 1) and 50240000000025B (logo for Business Entity 2), use the following placeholders to declare the logos:

[img|byid:50130000000014A][img|byid:50240000000025B]
  1. Open the template to be edited.
  2. In the Header & Footer section, click next to, for example, the Header field and add the placeholders as required.

    Alternatively, you can click Edit in the detail view to edit the field.

  3. Click Save.

Adding Business Entity-Specific Footers

Now you add two footers to the Footer field. To allow them for being addressed individually, you wrap them in addressable DIV elements, like

<div class="footer-Entity1">Business Entity 1 Footer Content</div>
<div class="footer-Entity2">Business Entity 2 Footer Content</div>
  1. Open the template to be edited.
  2. In the Header & Footer section, click next to the Footer field and add the footer texts as required.

    Alternatively, you can click Edit in the detail view to edit the field.

  3. Click Save.

Finally, you hide the logos and footers by default and enable them based on the business entity. These custom CSS rules do the job:

#50130000000014A, #50240000000025B {
    position: absolute;
    left:0;
    top:0;
    display: none;
}

.footer-Entity1, .footer-Entity2 {
    display: none;
}

.business-entity-AMERICA #50130000000014A, .business-entity-AMERICA .footer-Entity1 {
    display: block;
}

.business-entity-EUROPE #50240000000025B, .business-entity-EUROPE .footer-Entity2 {
    display: block;
}
  1. Open the template to be edited.
  2. In the Layout & Design section, click next to the Custom CSS field and specify the CSS code as required.

    Alternatively, you can click Edit in the detail view to edit the field.

  3. Click Save.

Configuring Transaction Display

Displaying Transaction Records on Invoices

You can configure JustOn to print a table of transaction records on an invoice. To this end, provide a corresponding configuration (in JSON notation) in the template field Transaction Records.

Configuration Options

The following configuration records are possible:

Keyword Data Type Possible Values Description
active Boolean true or false Activates the current configuration record.
title string The text to be printed above the transaction table.
name string object API name Specifies the source object for the transaction records to be displayed.
Note that the object needs a lookup relationship to the invoice.
invoiceFieldName string Specifies the field that holds the invoice number. Optional, required if there are more than one lookup fields.
fields list of strings field names Specifies the columns and their order to be rendered.
JustOn takes the column header from the field labels, and it considers the field types and applies the corresponding number and date formats of the template.
You can use the special field PosNo to display a running number of the records in a separate column.
calculationFields list of strings field names Specifies the fields (columns) whose values are to be added up.
order string Specifies a comma-separated list of fields whose values are to define the sort order of the records (optional).
conditions list of strings Specifies complex conditions (optional). Can be used to restrict the number of printed records, like Quantity > 1000.
Multiple conditions are separated by AND. String values must be enclosed in single quotes.
For more details, see the SOQL and SOSL Reference in the Salesforce Developer Documentation.
subtotal map: string => list<string> Specifies a map of fields to field lists. Determines that a subtotal is printed when a column (the "field") changes its value. The "field list" specifies the subtotal fields.
Configuration Examples

Show all records of the type Transaction__c that are related to the current invoice:

[{
    "active" : true,
    "title" : "Billed Transactions",
    "name" : "Transaction__c",
    "fields" : [ "Date__c", "ExternalId__c", "Description__c", "Quantity__c" ],
    "calculationFields" : [ "Quantity__c" ],
    "order" : "Type__c, Date__c"
}]

Show all records of the type Transaction__c that have set the type Foo, and hide records of the type Bar:

[{
    "active" : true,
    "title" : "Billed Transactions of type Foo",
    "name" : "Transaction__c",
    "fields" : [ "Date__c", "ExternalId__c", "Description__c", "Quantity__c" ],
    "order" : "Date__c",
    "conditions" : [ "Type__c = 'Foo'" ]
},
{
    "active" : false,
    "title" : "Billed Transactions of type Bar",
    "name" : "Transaction__c",
    "fields" : [ "Date__c", "ExternalId__c", "Description__c", "Quantity__c" ],
    "order" : "Date__c",
    "conditions" : [ "Type__c = 'Bar'" ]
}]

Show all transaction detail records that refer to the invoice via the field ONB2__Transaction__r.ONB2__Invoice__c:

[{
    "active" : true,
    "title" : "Billed Transaction Details",
    "order" : "Date__c",
    "name" : "TransactionDetail__c",
    "fields" : [ "Date__c", "Quantity__c", "Price__c" ],
    "invoiceFieldName" : "Invoice__c"
}]

Display a subtotal after each change of Description__c and Title__c:

[{
    "active" : true,
    "title" : "Billed Transactions",
    "name" : "Transaction__c",
    "fields" : [ "Date__c", "ExternalId__c", "Description__c", "Quantity__c" ],
    "calculationFields" : [ "Quantity__c" ],
    "order" : "Type__c, Date__c",
    "subtotal" : { "Description__c" : ["Quantity__c", "Price__c"],
                   "Title__c" : ["SingleIndividualCount__c"]}
}]

When invoicing objects in a parent-child relation, show the child records in the transaction table:

This example assumes you invoice Case records (= source parent object), with Product Consumed and Time Sheet Entry records (= source child objects) that represent the actual usage data, as outlined in Best Practice: JustOn for Field Service. Now you want two transaction tables to be displayed on the invoice PDF: one that lists the date, name and quantity of the products consumed and another one that lists the date and quantity of the time sheet entries.

Make sure to select ON_AddToTransactionTable on both the parent and the child records.

[{
    "active" : true,
    "title" : "Products Consumed",
    "name" : "ProductConsumed__c",
    "invoiceFieldName" : "ON_Invoice__c",
    "invoiceRelationshipFieldName" : "Case__r.ON_Invoice__r",
    "fields" : [ "ON_Date__c", "ON_Title__c", "ON_Quantity__c" ]
},
{
    "active" : true,
    "title" : "Spent Time",
    "name" : "TimeSheetEntry__c",
    "invoiceFieldName" : "ON_Invoice__c",
    "invoiceRelationshipFieldName" : "Case__r.ON_Invoice__r",
    "fields" : [ "ON_Date__c", "ON_Quantity__c" ]
}]
  1. Open the template to be edited.
  2. In the Transaction Records field, specify the transaction table configuration as required.
  3. Click Save.

    Once set up as required, this triggers JustOn to create the transaction table and print it to the invoice PDF. For details about regenerating the table, see Creating New Transaction Tables.

Note

Make sure that the checkbox fields

  • ON_AddToTransactionTable on the source object (see Controlling Fields) and
  • DisplayTransactionTables on the invoice

are selected.

If your business requires to show many columns in the transaction tables, you may need to rotate the corresponding pages of the invoice PDF in order to print landscape, and to use (most of) the available page width. To do so, you add a corresponding CSS rule to the template.

  1. Open the template to be edited.
  2. In the Layout & Design section, click next to the Custom CSS field and specify the following CSS code:

    /* sets landscape page format */
    @page land {
        size: landscape;
    }
    .c9 {
        page: land;
    }
    /* forces using the available page width */
    .transaction-records-table {
        width: 25cm;
    }
    
  3. Click Save.

Attaching Transaction CSV to Invoices

You can configure JustOn to generate CSV files for transaction records to be attached to invoices. Use this functionality if the transaction tables as printed directly on invoices become too large or if you need the CSV files for a specific purpose.

To generate transaction CSV files, provide a corresponding configuration (in JSON notation) in the template field Transaction CSV.

Configuration Options

The following configuration records are possible:

Keyword Data Type Possible Values Description
active Boolean true or false Activates the current configuration record.
name string object API name Specifies the source object for the transaction records to be displayed.
Note that the object needs a lookup relationship to the invoice.
title string Part of the CSV file name, which is generated as follows InvoiceNo_ObjectName_Title_No.csv by default.
Can contain placeholders with all invoice-related objects as sources, including
Invoice/Default
Account
BusinessEntity
EmailContact
PaymentInstrument
RelatedInvoice
Subscription
Template
In addition, the built-in placeholder ObjectName is supported.
If title contains at least one placeholder, the file name is generated from the rendered title string only, replacing the default file name pattern except for the file number.
The title string [Name]_[ObjectName]_[InvoiceDate:yyyy-MM-dd] will generate the following file name: InvoiceNo_ObjectName_InvoiceDate_No.csv (with the date forced to the ISO format).
invoiceFieldName string Specifies the field that holds the invoice number. Optional, required if there are more than one lookup fields.
order string Specifies a comma-separated list of fields whose values are to define the sort order of the records (optional).
conditions list of strings Specifies complex conditions (optional). Can be used to restrict the number of printed records, like Quantity > 1000.
Multiple conditions are separated by AND. String values must be enclosed in single quotes.
For more details, see the SOQL and SOSL Reference in the Salesforce Developer Documentation.
config map Specifies a configuration that defines the columns and format of the CSV file. For details, see Defining CSV File JSON Configuration.
The config key must have a row setting with the following row definitions:
headerRow – A list of column labels to be printed at the start of each CSV file.
recordRow – A list of fields where each row corresponds to a transaction record.
Configuration Example
[{
"active" : true,
"name" : "Transaction__c",
"order" : "Type__c, Date__c",
"invoiceFieldName" : "Invoice__c",
"conditions" : [ ],
"config" : {
             "useASCII" : false,
             "rows" : {
                        "headerRow" : [ "Date", "ExternalId", "Description", "Quantity" ],
                        "recordRow" : [ "Date__c", "ExternalId__c", "Description__c", "Quantity__c" ]
                      },
             "rowOrder" : [ "headerRow","recordRow" ],
             "options" : {
                           "timeFormat" : "hh:mm a",
                           "language" : "en",
                           "groupingSeparator" : "",
                           "decimalSeparator" : ".",
                           "dateFormat" : "yyyy/MM/dd"
                         },
             "decimalPlaces" : { },
             "columnSeparator" : ","
           }
}]
  1. Open the template to be edited.
  2. In the Transaction CSV field, specify the transaction CSV file configuration as required.
  3. Click Save.

    Once set up as required, this triggers JustOn to create the transaction CSV file and attach it to the invoice when finalizing the invoice. For details about regenerating the table, see Creating New Transaction Tables.

    At the size of 2048 kB, JustOn splits the CSV attachment into a new file. So if there are many transaction records, JustOn produces multiple CSV files, putting a numbering to the file name like 2019-01515_Orders_All_1.csv, 2019-01515_Orders_All_2.csv, etc.

Note

To have JustOn create and attach the transaction CSV files, make sure, in addition, that

  • The checkbox field ON_AddToCsv on the source object (see Controlling Fields) is selected
  • In the template field Email File Types, CSV files are not excluded from being attached to emails.

    With the field empty (default), all files, including CSV, are attached except for transaction table HTML (which is printed to the PDF).

  • You execute a batch finalization.

Configuring Installment Table on Invoices

With an applied installment configuration, JustOn automatically prints the payment plan to the invoice PDF. There are two template fields that control the display of the corresponding installment information:

Template Field Description
Installment Columns Defines the columns for the installment table. Must be a list of Payment field names separated by semicolons. Defaults to Title__c;Date__c;Amount__c.
Installments Text Specifies text to be rendered above the installment table.

In addition, you can modify or translate the labels for the column headers.

Modifying Installment Table Columns

To configure the contents of the installment table:

  1. Open the template to be edited.
  2. In the Information section, click next to the Installment Columns field and specify the installment table configuration as required.

    Alternatively, you can click Edit in the detail view to edit the field.

    To display the service period for service period-based installments, for example, specify

    Title__c;ServicePeriodStart__c;ServicePeriodEnd__c;Date__c;Amount__c
    
  3. Click Save.

Modifying Installment Table Column Headers

The template field Override Labels allows to define new labels for the fields that are displayed in the installment table. The field value is in JSON notation. For details, see Configuring Override Labels.

To modify or translate the column header labels:

  1. Open the template to be edited.
  2. In the Overrides section, click next to the Override Labels field and specify the override definition in JSON as required.

    Alternatively, you can click Edit in the detail view to edit the field.

    To define new labels for the default fields, you can use, for example:

    {
        "Payment__c": {
            "Title__c": "Installment Payment",
            "Date__c":"Due Date",
            "Amount__c":"Due Amount"
        }
    }
    
  3. Click Save.

Specifying Installment Note

To specify a text that introduces the payment plan:

  1. Open the template to be edited.
  2. In the Additional Content section, click next to the Installment Text field and type the text as required.

    Alternatively, you can click Edit in the detail view to edit the field.

  3. Click Save.

Configuring Balance Table on Invoices

With an existing invoice balance, JustOn Billing & Invoice Management automatically prints the balance to the invoice PDF.

Balance Table Concepts

An existing balance on the invoice usually alters the payment amount – this is why the balance records are not printed as a separate table but as part of the invoice table between the invoice grand total and the final payment amount, like illustrated below:

Pos Title Quantity Tax Rate Unit Price Pos Total
1 Product 1 0,00% 25,00 25,00
Subtotal (net) 25,00
Tax (0,00%) 0,00
Grand Total 25,00
Prepayment 2017-03-02 -10,00
Payment Amount 15,00

There are two template fields that control the display of the corresponding balance information:

Template Field Description
Balance Columns Defines the columns for the balance table. The definition must be a list of balance field API names separated by semicolons. If BalanceTitle is used, the column will display the text defined in the field Balance Types.
The default definition is BalanceTitle;Date__c;Amount__c
Balance Types Specifies a mapping (in JSON notation) of the values defined in the Type field of the Balance object to the display text or, for locale-specific templates, the corresponding translation (which can include placeholders).
Types that are not specified in the mapping are not displayed on the invoice.

The default balance type mapping is

[ {
"type" : "Payment",
"title" : "Payment"
}, {
"type" : "Refund",
"title" : "Refund"
}, {
"type" : "Prepayment",
"title" : "Prepayment"
}, {
"type" : "Payout",
"title" : "Payout"
}, {
"type" : "Clearing",
"title" : "Clearing"
}, {
"type" : "Settlement",
"title" : "Settlement for Invoice [RelatedInvoiceNo]"
}, {
"type" : "Dunning Fee",
"title" : "Dunning Fee"
} ]

If you use locale-specific templates, you provide the balance title translations in the corresponding balance type mapping. In a template used for German-speaking customers, for example, the balance type mapping may look like

[ {
"type" : "Payment",
"title" : "Zahlung"
}, {
"type" : "Refund",
"title" : "Rückerstattung"
}, {
"type" : "Prepayment",
"title" : "Vorkasse"
}, {
"type" : "Payout",
"title" : "Auszahlung"
}, {
"type" : "Clearing",
"title" : "Auszifferung"
}, {
"type" : "Settlement",
"title" : "Ausgleich für [RelatedInvoiceNo]"
}, {
"type" : "Dunning Fee",
"title" : "Mahngebühr"
} ]

Modifying Balance Table Columns

Depending on your organization's requirements, you must add or remove columns or change their sequence.

  1. Open the template to be edited.
  2. In the Information section, click next to the Balance Columns field and specify the balance column configuration as required.

    Alternatively, you can click Edit in the detail view to edit the field.

  3. Click Save.

Info

You can use any balance field. Note that the specified order defines the column sequence.

Modifying Balance Type Display

You can configure which balance types are to be displayed in the balance table and modify their display names.

  1. Open the template to be edited.
  2. In the Information section, click next to the Balance Types field and specify the balance type configuration as required.

    Alternatively, you can click Edit in the detail view to edit the field.

  3. Click Save.

Hiding Balance Table

Depending on your business requirements, you may need to prevent the balance table from being printed. There are two ways to hide the balance table:

  • emptying the Balance Types field,
  • using a custom CSS rule.

Hiding Balance Table Clearing Balance Types

You can prevent the balance table from being printed, clearing the field contents. This takes advantage of the fact that balance types that are not specified in the Balance Types field are not displayed on the invoice.

  1. Open the template to be edited.
  2. In the Information section, click next to the Balance Types field and clear its contents.

    Alternatively, you can click Edit in the detail view to edit the field.

  3. Click Save.

Hiding Balance Table Using CSS

Alternatively, you can apply a custom CSS rule that hides the balance table:

  1. Open the template to be edited.
  2. In the Layout & Design section, click next to the Custom CSS field and specify the following CSS code:

    tr.balances {
        display: none;
    }
    
  3. Click Save.

Displaying Tax Breakdown Table

If multiple taxes are applied, JustOn can print the tax breakdown table on the invoice PDF. This table contains one line for each applied tax rule. The amount is the sum of all taxes of the same rule. The table is sorted first by the tax type and then by the applied tax rule.

To configure the tax breakdown table display in the invoice template, use the following fields:

Field Description Default Value
Tax Table Checkbox to enable or disable the tax table display on the invoice
Tax Table Text An introductory text for the tax table The composition of the taxes is presented on the following table.
Tax Table Columns Defines the tax detail fields (API names) to be displayed as columns in the tax table, separated by semicolon.
To display the local currency, add LocalAmount.
Name;AppliedTaxRule__c;Rate__c;Amount__c

Info

In addition to the default tax table columns (Name;AppliedTaxRule__c;Rate__c;Amount__c), JustOn supports the following columns:

  • LocalAmount: the amount in local currency
  • TaxBaseAmount: the basis (net) amount from which the tax is calculated
  • LocalTaxBaseAmount: the basis (net) amount in local currency
  • GrossAmount: the gross amount (tax base amount + tax amount)
  • LocalGrossAmount: the gross amount in local currency

This allows for individually displaying the tax-specific net and gross sums on the invoice PDF as required for some jurisdictions.

Before using the tax breakdown table, you may have to add the corresponding fields to the template layout:

  1. Navigate to the object management settings of the Template object.
  2. Click Page Layouts.
  3. In the row of Template Layout, click Edit.
  4. Drag the fields Tax Table, Tax Table Columns and Tax Table Text to the Line Items section.
  5. Click Save to save the modified page layout.

For help about modifying page layouts, see Managing Pages.

To configure the tax table display:

  1. Open the template to be edited.
  2. Click Edit in the detail view.
  3. Modify the values for Tax Table, Tax Table Text and Tax Table Columns as required.
  4. Click Save.

Info

Be aware that the tax rate uses five decimal places by default, which are also displayed in the tax breakdown table. If your business requires different display settings, you can override the decimal places. To show, for example, two decimal places in the tax breakdown table, use the following JSON configuration in the Decimal Places field:

{
    "TaxDetail__c": {
        "Rate__c": 2
    }
}

Configuring Payment Reference Text

Depending on your organization's requirements, you specify a string that is to be written as the payment reference for SEPA payments. To do so, you configure the template field Payment Reference.

  1. Open the template to be edited.
  2. In the Payment Information section, click next to the Payment Reference field and modify the information as required.

    Modify the default value [InvoiceNo] - [InvoiceDate] as necessary.

    You can use the placeholders that are available for the invoice context.

  3. Click Save.

Configuring Reverse Charge Notice Text

You can configure JustOn to display a reverse charge notice for invoices to be sent to buyers in specific countries.

The invoice template includes a specific text block for the reverse charge information.

Info

Whether the text is displayed or not depends on the setting of the corresponding controlling field on the invoice.

The template supports separate text blocks for three use cases:

Invoice Field ShowReverseChargeText Selected Text Block
RC Reverse Charge Text
EU Reverse Charge Text EU
Non-EU Tax Information Non-EU

To configure this text:

  1. Open the template to be edited.
  2. In the Texts section, click next to the Reverse Charge Text, Reverse Charge Text EU and Tax Information Non-EU fields and specify the information as required.

    Alternatively, you can click Edit in the detail view to edit the fields.

  3. Click Save.

Info

Template text blocks can contain

  • plain text
  • placeholders
  • HTML code for tables, lists and links

If you use HTML code in template text blocks, make sure to write all code in a single line to avoid line breaks being converted to <br/> tags.

Displaying Outstanding Invoices

Depending on your business requirements, you can have JustOn print a table of outstanding invoices on an invoice PDF. This table lists other open invoices of the corresponding account.

To configure the outstanding invoices table display in the invoice template, use the following fields:

Field Description Default Value
Outstanding Invoices Checkbox to enable or disable the outstanding invoices table display on the invoice.
Outstanding Invoices Text Specifies the text to be printed above the table of outstanding invoices. For your information, below is a list of outstanding invoices that are either unpaid, partially paid or overpaid.

To configure the outstanding invoices table display:

  1. Open the template to be edited.
  2. Click Edit in the detail view.
  3. In the Additional Content section, select or deselect the checkbox Outstanding Invoices and modify the value for Outstanding Invoices Text as required.
  4. Click Save.

Displaying QR Codes

In order for invoice recipients to make use of QR codes to initialize payments, the printed invoices must include the QR codes. To this end, you must configure the relevant invoice template accordingly.

JustOn Billing & Invoice Management provides two custom placeholders that retrieve the produced QR code images. You place these placeholders in an appropriate section of the relevant template.

Placeholder Usage
[CreditTransferQrCode] Retrieves the SCT QR code. Usually placed in the Template field Payment Info Bank Transfer.
[PaymentPageUrlQrCode] Retrieves the payment page code. Usually placed in the Template field Payment Info Online Payment.

Note

Make sure to apply the placeholder filter no-persist to the QR code placeholder. It guarantees that the correct image is inserted after modifying input values and after finalizing the invoice.

  1. Open the template to be edited.
  2. Click next to the relevant Template field (standard text or payment information) and specify the information as required.

    To direct an invoice recipient to the payment page, you can use, for example, this text in the Payment Info Online Payment field:

    Scan the code to open our payment page: [PaymentPageUrlQrCode|no-persist]
    
  3. Click Save.

Displaying relevant payment information next to QR code

Your customers may want to see what is "inside" the QR code. To this end, you can disclose the payment-relevant information from the code.

SEPA Credit Transfer QR Codes

For SEPA credit transfer (SCT) QR codes, the payment-relevant information includes the recipient, the recipient's IBAN, the amount to transfer, and the payment reference.

Assume you want to display this data in a table next the QR code image. Proceed as follows:

  1. Create the custom placeholder [PaymentReference].

    Field Value
    Name PaymentReference
    Field PaymentReference__c
    Render as TEXT
    Source Invoice

    For details, see Defining Custom Placeholder.

  2. Configure an appropriate Template field to include the QR code.

    This can be a standard text block or a payment information text.

    If your business requests a SEPA credit transfer from the invoice recipient, the invoice payment method is usually set to Bank Transfer. In this case, you can use the Template field Payment Info Bank Transfer.

    Remember that if you use HTML code in template text blocks, you must write all code in a single line to avoid line breaks being converted to <br/> tags.

    Specify, for example, the following text:

    Use this code to initialize the payment operation using the banking app on your phone.
    
    <table><tr><td rowspan="6">[CreditTransferQrCode|no-persist]</td><td><br/></td></tr><tr><td><br/></td></tr><tr><td><em>Payment information:</em></td></tr><tr><td><br/></td></tr><tr><td><table><tr><td>Recipient:</td><td>[BusinessEntityCompany]</td></tr><tr><td>IBAN:</td><td>[BusinessEntityIBAN]</td></tr><tr><td>Amount:</td><td>[Balance|no-persist]</td></tr><tr><td>Reference:</td><td>[PaymentReference|no-persist]</td></tr></table></td></tr><tr><td><br/></td></tr></table>
    

    This produces the following output in the PDF:

    qr_code_sct_info
    Example SCT QR code and disclosed payment information

    If you want a smaller and framed image, you can use, for example, the following HTML table and some custom CSS.

    HTML table
    <div class="page-break"><table width="100%"><tr><td width="30%"><b>Bank Name (BIC):</b></td><td width="70%">[BusinessEntityBankName] ([BusinessEntityBIC])</td><td rowspan="6" style="text-align: right;"><div class="qr-code-wrapper">[CreditTransferQrCode|no-persist]<span class="vertical-text">Scan to pay</span></div></td></tr><tr><td></td><td></td></tr><tr><td><b>Recipient:</b></td><td>[BusinessEntityCompany]</td></tr><tr><td><b>IBAN:</b></td><td>[BusinessEntityIBAN]</td></tr><tr><td><b>Payment Amount:</b></td><td>[Balance|no-persist]</td></tr><tr><td><b>Payment Reference:</b></td><td>[PaymentReference]</td></tr></table><div/>
    
    Custom CSS
    .CreditTransferQrCode.value img {
        width: 2.5cm !important;
        height: 2.5cm !important;
        border: 2px solid #000;
    }
    .vertical-text {
        display: inline-block;
        background-color: white;
        font-size: 10px;
        position: relative;
        bottom: 13px;
        padding-left: 3px;
        padding-right: 3px;
    }
    .qr-code-wrapper {
        text-align: center;
    }
    table tr,table td {
        page-break-inside: avoid;
    }
    table {
        page-break-after: avoid;
    }
    

    This produces the following output in the PDF:

    qr_code_sct_frame_info
    Example SCT QR code with frame and help text

Payment Page QR Code

In QR codes that encode the link to JustOn Cash Management's payment page, the corresponding URL is the only encoded information.

Assume you want to display the URL as a readable text together with the QR code image. Proceed as follows:

  1. Create the custom placeholder [PaymentPage].

    Field Value
    Name PaymentPage
    Field PaymentPageUrl__c
    Render as PLAIN
    Source Invoice

    You can also decide to overwrite the built-in placeholder [PaymentPageURL] (which creates a clickable link, masking the URL) if you are sure that you will not need it.

    For details, see Defining Custom Placeholder.

  2. Configure an appropriate Template field to include the QR code.

    This can be a standard text block or a payment information text.

    If your business requests the payment to be made using JustOn Cash Management's payment page, the invoice payment method must be set to Online Payment. In this case, you can use the the Template field Payment Info Online Payment.

    Specify, for example, the following text:

    Scan the code to open our payment page:
    
    [PaymentPageUrlQrCode|no-persist]
    
    [PaymentPage|no-persist]
    

    If you want the QR code image to be a clickable link, use, for example, this text:

    Scan or click the code to open our payment page:
    
    <a href="[PaymentPage|no-persist]">[PaymentPageUrlQrCode|no-persist]</a>
    
    [PaymentPage|no-persist]
    

    This produces the following output in the PDF:

    qr_code_paypage_info
    Example payment page QR code and disclosed URL

Accessing Template Debug Mode

The layout, styling, positioning of the template building blocks is controlled using CSS rules. JustOn defines a default set of CSS rules (see CSS Rules).

To identify the class for an element that you want to override using custom CSS, you can proceed as follows:

  1. Open the detail view of the corresponding record (invoice, dunning reminder or account statement).

    A standard URL of an invoice, for example, may look like

    https://<server>/apex/InvoiceView?id=<id>&sfdc.override=1 (Classic UI) or

    https://<server>/lightning/r/ONB2__Invoice__c/<id>/view (Lightning UI)

  2. Modify the URL as follows.

    1. For Classic, replace the InvoiceView or DunningView directive with InvoicePDF or DunningPDF, respectively, and append the query string &debug=true like:

      https://<server>/apex/InvoicePDF?id=<id>&sfdc.override=1&debug=true
      
    2. For Lightning, replace the complete path with apex/ONB2__InvoicePDF?id=<id> or, respectively, apex/ONB2__DunningPDF?id=<id> for dunning reminders or account statements, and append the query string &debug=true like:

      https://<server>/apex/ONB2__InvoicePDF?id=<id>&debug=true
      

    If required, you can also add a language query string, like &lang=en, for example

    https://<server>/apex/ONB2__InvoicePDF?id=<id>&debug=true&lang=en
    
  3. Press Enter.

    This opens the intermediate HTML file, which you can now inspect using your tool of choice.