Skip to content

Setting Up Account Statement Management

To support accounting purposes, JustOn allows for generating account statements. An account statement represents a report that summarizes the balances of a given account for a specific time period. PDF copies of the account statements can then be distributed to the corresponding recipients.

Setting up account statement management may involve the following tasks:

Info

For details about account statement creation and distribution, see Managing Account Statements.

Enabling Account Statement Generation for Single Accounts

To enable the option for individually creating an account statement, add the Account Statement button to the account detail view.

  1. Navigate to the object management settings of the Account object.
  2. Click Page Layouts.
  3. In the Account Layout row, click Edit.
  4. Select the Buttons palette.
  5. Drag the Account Statement button to the Custom Buttons area in the Account Detail section.
  6. Click Save to save the modified page layout.

For help about modifying page layouts, see Managing Page Layouts.

Enabling Account Statement List Display

Optionally, you can enable the display of related account statements on the account detail page using Salesforce's related list functionality (see Work with Related Lists on Records in the Salesforce Help).

  1. Navigate to the object management settings of the Account object
  2. Click Page Layouts.
  3. In the Account Layout row, click Edit.
  4. Select the Related Lists palette.
  5. Drag the Dunnings list to the Related Lists section.
  6. Click Save to save the modified page layout.

For help about modifying page layouts, see Managing Page Layouts.

Customizing Account Statement PDF

JustOn ships a default template detail Account Statement, used to overwrite certain template fields when printing account statements to PDF files.

Note

You must create a template detail for account statements in two cases:

  • There is no template detail Account Statement.
  • You use account-specific templates (referred to using ON_Template__c) - then you need template-specific template details for account statements as well.

Configuring the Account Statement template detail according to your organization's requirements may involve:

Adjusting Account Statement Table

The account statement is made up of balances, hence the account statement template detail overwrites the balance table definition. As explained in Balance Table Concepts, there are two fields that control the balance table display: Balance Columns and Balance Types.

Account Statement Table Concepts

The field Balance Columns defines the columns for the balance table, where the definition must be a list of balance field API names separated by semicolons. The default value in the Account Statement template detail is:

BalanceTitle;Date__c;OpenAmount;AmountGT

where

  • OpenAmount displays the open amount of invoices/credits on the creation date of the account statement,
  • AmountGT adds an additional row that shows the aggregated amount of all balances before the account statement start date.

The field Balance Types specifies a mapping (in JSON notation) of the values defined in the Type field of the Balance object to some display text (which can include placeholders). The default value for account statements 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"
}, {
  "type" : "Invoice",
  "title" : "Invoice"
}, {
  "type" : "Credit",
  "title" : "Credit"
}, {
  "type" : "Manual",
  "title" : "Manual"
} ]

Types that are not specified in the mapping are not displayed on the invoice.

If required, you can define an aggregation per balance type. This results in a single line on the account statement even if there are multiple balances available. The value aggregation is to be defined using the following pattern:

"aggregate" : {"FIELDNAME1":"FUNCTION","FIELDNAME2":"FUNCTION"}

The following aggregation functions are available:

Function Supported Data Types Description
SUM Numeric and string values Adds up all values, preserves Null values.
MIN Numeric, Date and DateTime values Selects the minimum of all values, preserves Null values.
MAX Numeric, Date and DateTime values Selects the maximum of all values, preserves Null values.
LAST Numeric, string and Date values Selects the last processed value.
CLEAR Numeric, string, Date and DateTime values Allows to explicitly clear fields on the aggregated balance.

To aggregate, for example, balances of the type Payment, you can use:

{
  "type" : "Payment",
  "title" : "Payment",
  "aggregate" : {"Amount__c":"SUM", "Reference__c":"SUM"}
}

Modifying Account Statement Table Columns

Depending on your organization's requirements, you must add or remove columns or change their sequence modifying the Balance Columns field (see Account Statement Table Concepts).

  1. Open the template detail to be edited (Account Statement by default).
  2. In the Information section, double-click 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.

Modifying Account Statement Type Display

You can configure which balance types are to be displayed in the balance table and modify their display names modifying the Balance Types field (see Account Statement Table Concepts).

  1. Open the template detail to be edited (Account Statement by default).
  2. In the Information section, double-click 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.

Modifying Template Detail Texts

Depending on your organization's requirements, you must modify the text building blocks for the account statement. The relevant texts are included in the following fields of the Account Statement template detail:

Field Description Default Value
Display Type Specifies the type of the document to be printed to the PDF. Statement of account
Info Right Defines an area for printing general information like a page counter and the date above the actual document text.
You can use all account and dunning placeholders here.
Date: [DunningDate]
Email Subject Defines the default email subject, can include placeholders. Statement of account
Email Body Defines the plain text body for the email, can include placeholders.
Line breaks are considered.
PDF Name Specifies the name for the generated PDF file, can include placeholders. AccountStatement_[AccountName|cut:70].pdf

To modify the texts:

  1. Open the template detail to be edited (Account Statement by default).
  2. Double-click the intended field and specify the corresponding text as required.
    Alternatively, you can click Edit in the detail view to edit all fields at once.
  3. Click Save.

Adjusting Custom Labels

Depending on your organization's requirements, you can modify the labels used in the account statement table. These labels are defined as custom labels in Salesforce.

Custom Label Default Value
Balance Balance
BalanceAggregatedRow Balance amount up to [BalanceDate]
AmountGT Amount
OpenAmount Open Amount
BalanceTitle Item

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. In Setup, 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.

Info

For help about modifying custom labels, see Create and Edit Custom Labels in the Salesforce Help.

Defining Balance Sort Order

By default, the entries of the account statement are sorted by the balances on which they originally base. The first order criterion is their type, the second their date. Since the balance's Type field is a picklist field, which has its own sort order, the resulting display order may not resemble the usual alphabetical or numerical order.

You can, however, define a custom sort order. To do so, you create the custom field CustomSequence__c on the Balance object. You can then specify your sorting criterion as a formula, which produces a value that is sorted alphabetically or numerically.

  1. Navigate to the fields list of the Balance object.
  2. Create the following new field.
    For help about creating fields, see Managing Object Fields.
API Name Data Type Description
CustomSequence Formula Specifies the sorting criterion, returns a value that is sorted in alphanumeric order.
Formula(Text) values are sorted alphabetically
Formula(Date) values are sorted by date

The following examples illustrate the behavior:

Criterion Formula Return Type Example Value
Sort by type, then by amount TEXT(Type__c) + TEXT(Amount__c) Text Invoice100,00
Sort by date Date__c Date 2017-11-30
Sort by invoice record Invoice__c Text a01000000000001

Enabling Invoice PDF Attachments

You can attach the related invoice PDF files to the account statement. To enable the invoice PDF attachment, the feature has to be activated in the global settings.

  1. In Setup, open Custom Settings.
    In Salesforce Lightning, navigate to Custom Code > Custom Settings.
    In Salesforce Classic, navigate to Develop > Custom Settings.
  2. Click Manage in the row of Global Settings.
  3. Click Edit in the Default row.
  4. Select the checkbox Attach Invoice PDFs to Account Statement.
  5. Click Save.

Note

Note that processing large or many PDF files may quickly exceed the Apex heap size limit.