Skip to content

Setting Up Balance Management Options

JustOn creates balances for invoices, credits, payments, refunds, dunning fees, etc. Setting up this feature involves the following tasks:

Enabling Balance Overpayment

In order to enable balance overpayment, 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 Allow Overpayments.
  5. Click Save.

Enabling Balance Write-Off

In order to enable balance write-off, 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. In the Write-Off Threshold field, specify the percentage as required.
  5. In the Write-Off Cap Amount and the Write-Off Cap Currency fields, specify an absolute amount as required.
    You can combine the percentage and the absolute amount. In this case, JustOn limits the calculated threshold to the specified amount.
  6. Click Save.

Configuring Balance Table on Invoices

With an existing invoice balance, JustOn automatically prints the balance to the invoice PDF.

Balance Table Concepts

An invoice balance 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 some display text (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"
} ]

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

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

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, double-click 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:

tr.balances {
    display: none;
}
  1. Open the template to be edited.
  2. In the Layout & Design section, double-click 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.

Scheduling Balance Assignment

You can set up a job in order to have balances automatically assigned to open invoices on a regular basis.

The balance assignment job does not require additional parameters. That is, you can set up the job directly for the corresponding batch chain AssignBalancesChain. For details, see Scheduling Concepts.

To schedule the balance assignment batch chain, you can use either JustOn's Scheduled Jobs page or Salesforce's Schedule Apex functionality. For details, see Scheduling a Job.

Via JustOn's Scheduled Jobs page:

  1. Open the Scheduled Jobs page.
    Open the JobsSetup page directly, or navigate to Visualforce Pages > JobsSetup in Setup, and open the preview.
  2. From the Apex Job drop-down list, select Batch Chain Job.
  3. In the Job Name field, specify AssignBalancesChain.
  4. From the Start Time drop-down list, select the preferred execution time.
  5. Optionally, edit the displayed cron expression to adjust the execution time.
  6. Click Schedule.
    ▶ This sets up the balance assignment to be executed at the specified time.

Info

From the Scheduled Jobs page, you can also run the batch chain immediately.

Via Salesforce's Schedule Apex functionality:

  1. In Setup, open Apex Classes.
    In Salesforce Lightning, navigate to Custom Code > Apex Classes.
    In Salesforce Classic, navigate to Develop > Apex Classes.
  2. Click Schedule Apex on top of the list.
  3. Specify the details as required.
    • Job Name: AssignBalancesChain
    • Apex Class: ScheduledBatchChain
    • Frequency: Weekly or Monthly (with an according weekday or day of month setting)
    • Start
    • End
    • Preferred Start Time
  4. Click Save.
    ▶ This sets up the balance assignment to be executed at the specified time.

For more details about job scheduling, see Scheduling a Job in the JustOn documentation and Schedule Apex in the Salesforce Help.

Next steps:

Managing Balances

Return to JustOn Administration.