Skip to content

Enabling Deposit Invoices

Certain business use cases require merchants or suppliers to ask their customers for advance payments. To this end, JustOn allows for creating deposit invoices.

Businesses issue deposit invoices before any goods or services are supplied, usually with the intention to secure a sale. The deposit (or down payment) is a partial amount or a percentage of the total amount, which is to be paid up front. After the sale is completed, the deposit invoice is closed and the final invoice is issued.

For details on deposit invoices in JustOn, the usual workflow, their structure, etc., see Deposit Invoices.

Enabling deposit invoices in JustOn involves the following tasks:

If required, you can optionally

Info

JustOn 2.47 has introduced deposit invoices as an option to pro forma invoicing. As of JustOn 2.54, deposit invoices and pro forma invoices are available as separate features.

Adding Deposit Invoice Fields to Source Objects

In order to hold the required deposit invoice data, you must add new fields to the source object, which can be

Info

If you need multiple billing configurations when billing arbitrary objects, JustOn must distinguish between different sets of field configurations using control field suffixes. To this end, append recipient-specific suffixes to the ON fields, as explained in Enabling Deposit Invoices for Multiple Parties.

  1. Navigate to the fields list of the source object.
  2. Create the following new fields.

    API Name Data Type Description
    ON_Type Text (255) Must be set to Deposit in order to create deposit invoices. Is cleared automatically when the deposit invoice is closed.
    ON_ProformaInvoice Lookup (Invoice) Shows the related pro forma or deposit invoice.

    To have JustOn create a deposit line item, create one of the optional fields:

    API Name Data Type Description
    ON_DepositRate Percent (3,2) If set, JustOn creates a deposit line item with an amount of Deposit Rate * Total on the deposit invoice.
    If both a deposit rate and a deposit amount is defined, the amount takes precedence.
    ON_DepositAmount Currency (16,2) If set, JustOn creates a deposit line item with the specified amount on the deposit invoice.
    If both a deposit rate and a deposit amount is defined, the amount takes precedence.

    For help about creating fields, see Managing Object Fields.

Info

You can add more fields using the ON field mechanism.

Configuring Deposit Invoice Display

Adjusting Invoice Texts

Usually, a deposit invoice needs other texts on the printed document than the final invoice. You can therefore define a template detail – named Deposit – to provide appropriate texts.

For further information about template details and invoice PDF contents, see Configuring Template Details and PDF Contents.

The following fields are relevant on the template and the template detail:

Field Description Example Target
Display Type Specifies the type of the invoice to be printed to the PDF. It should reflect the nature of the pro forma or deposit invoice. Advance Invoice Template Detail
Text 2 Text to be rendered below the invoice line item table. Use it, for example, to describe how the deposit can be made (bank account etc.) and to specify the payment terms. Template Detail
Deposit Title Short description of the nature of the deposit
This field is mandatory if you have set a deposit rate or a deposit amount.
Advance Payment (50%) Template
Deposit Description Long description of the nature of the deposit Template
  1. Open the template or template detail to be edited.
  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 Spacing Between Deposit Invoice Line Item Table Parts

As explained in Deposit Invoice Structure, the deposit invoice first lists the invoice line items as Information type invoice line items, then shows an invoice line item of the type Deposit, which represents the advance payment. In order to visually separate the two table parts, add the following custom CSS rule to the invoice template:

  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.

    tr.Deposit.firstRowAfterSubtotal td {
        padding-top: 2.5em;
    }
    
  3. Click Save.

Enabling Deposit Gross Display

As explained in Deposit Invoice Structure, the deposit invoice lists the invoice line items as Information type invoice line items, followed by a subtotal section with tax breakdown. Optionally, you can display a line that shows the gross value for the Information type invoice line items.

To do so, add the following custom CSS rule to the invoice template:

  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.

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

Configuring Final Invoice Display

In the event of a final invoice with existing deposit payments, the invoice PDF shows additional information about the received payments and the final payments below the grand total. The corresponding sections include a detailed tax breakdown.

Example final invoice
Pos. Title Tax Rate Net Price
1 Some Goods 20% 1000
2 Some Service 20% 500
Subtotal Net 1500
Tax Amount 300
Deposit Gross 1800
Received Payments Net 750
Received Payments Tax 150
Received Payments Gross 900
Remaining Final Payment Net 750
Remaining Final Payment Tax 150
Remaining Final Payment Gross 900
Payment Amount 900

You can define the display of the grand total label using the template field Deposit Grand Total Label. The field can contain placeholders. It is used only for final invoices with deposit payments – in all other cases or if the field is empty, the invoice PDF shows the label of the invoice field Grand Total, which is the standard behavior. The other fields use custom labels.

Using custom CSS, you can adjust the positioning, layout, etc. according to your needs.

Label Custom Label Description
Grand total The total amount of the invoice.
Received Payments (net) ReceivedPaymentsNet The calculated total net amount of all payments received on the related deposit invoice. This is the sum of all balance amounts that are related to the deposit invoice without taxes. The tax rate is taken from the field TaxRate__c of the Deposit line item of the related deposit invoice.
Tax on Received Payments ([TaxRate]) ReceivedPaymentsTax Taxes on the total net amount of the payments received. The placeholder [TaxRate] is replaced by the actual value, like 7%.
Received Payments (gross) ReceivedPaymentsGross Total gross amount of the payments received. The display is disabled by the default CSS rules.
Remaining Final Payment (net) FinalPaymentNet The remaining net final payment amount.
Tax on Remaining Final Payment FinalPaymentTax Taxes on the remaining net final payment amount.
Remaining Final Payment (gross) FinalPaymentGross Remaining gross final payment amount. The display is disabled by the default CSS rules.

Info

Use overrides to overwrite the values of the custom labels.

Creating Process for Closing Deposit Invoices

Closing deposit invoices requires a process that calls the appropriate Apex class provided by JustOn. It closes the deposit invoice and prepares the source object for creating the final invoice (for details, see Deposit Invoice Closure).

Note

Depending on your use cases, the process setup and the objects to involve will vary.

The source object for the process depends on the object that is used for deposit invoicing:

Info

You can use multiple billing configurations when billing arbitrary objects with different sets of field configurations using recipient-specific suffixes. In this case, create an individual process with an individual trigger for each configuration.

Set up the process as follows:

  1. In Setup, open Process Builder.

    In Salesforce Lightning, navigate to Process Automation > Process Builder.

    In Salesforce Classic, navigate to Create > Workflow & Approvals > Process Builder.

  2. Click New.

  3. Specify a (descriptive) process name.
  4. Set the process to start when A record changes.
  5. Configure the process as required.

    Step Option Description
    Add Object Object The original object whose modifications are to close the deposit invoice
    Start the process The type of record change that triggers the process, either creation only or creation and modification
    Add Criteria Criteria for Executing Actions The type of criteria, determines whether to check for specific field values or to evaluate records using a formula
    Set Conditions | Build Formula The use case-specific criteria, either the filter conditions for evaluating field values or the formula
    Add Action Action Type The type of action to be executed, must be Apex
    Apex Class The Apex class to be executed, must be Close Proforma Invoice
    Set Apex Variables Invocable variables for the Apex class
    Object Id specifies the reference to the ID field of the original object
    Suffix string value that specifies a recipient-specific suffix, required when using multiple processes for multiple billing configurations
  6. Click Save.

  7. Click Activate.

    For help about creating processes, see Lightning Process Builder in the Salesforce Help.

Note

Make sure that closing a deposit invoice from its detail view using the Close button does not trigger the configured process for closing deposit invoices from source records. This may produce errors.

Example use case: Set a checkbox to start the close process

Assume you create invoices from orders. You can, for example, use a custom checkbox field ON_CloseProformaInvoice on the order to trigger the process when the checkbox is selected.

(1) Create the custom checkbox:

API Name Data Type
ON_CloseProformaInvoice Checkbox

(2) Set up the process as follows:

Option Value
The process starts when A record changes
Object Order
Start the process when a record is created or edited
Criteria for Executing Actions Conditions are met
Set Conditions [Order].Close Proforma Invoice Is changed True
[Order].Close Proforma Invoice Equals True
[Order].ON_ProformaInvoice__c Is null False
All of the conditions are met
Action Type Apex
Apex Class Close Proforma Invoice
Set Apex Variables Object Id Field Reference [Order].Id

This triggers JustOn to execute the process when the ON_CloseProformaInvoice checkbox is selected: It closes the deposit invoice and prepares the object for creating the final invoice (for details, see Deposit Invoice Closure).

Enabling Deposit Invoices for Multiple Parties

Generally, JustOn is set up to issue invoices to one recipient, usually via the account associated to the corresponding source record. Certain business use cases require billing to multiple parties, however – like, for example, in a marketplace scenario.

  1. Create multiple (recipient-specific) sets of ON fields as listed in Adding Deposit Invoice Fields to Source Objects.

    For details, see Creating Recipient-Specific Controlling Fields.

  2. Create an individual closing process with an individual trigger for each configuration set, specifying the corresponding recipient-specific suffix as an Apex variable.

    Process Name Trigger Control Field Suffix
    Close Deposit Merch checkbox Close_Merch Merch
    Close Deposit Buy checkbox Close_Buy Buy

Creating Deposit Invoice and Final Invoice From Different Sources

Your business may require to create a deposit invoice from one source object and the related final invoice from another. Think of the Salesforce CPQ process, for example: You can create the deposit invoice from a quote, and the final invoice from a CPQ subscription that is based on this quote.

In addition to the original deposit invoicing configuration, this approach involves the following steps:

  1. Set the deposit invoice fields on the two source objects.

    The first source object – the one from which you create the deposit invoice – requires these fields to hold the relevant deposit invoice data:

    API Name Description
    ON_Type Must be set to Deposit in order to create the deposit invoics.
    ON_ProformaInvoice Lookup the related deposit invoice.
    ON_DepositRate |
    ON_DepositAmount
    Used to set or calculate the price of the deposit line item to be created.

    The second source object – the one from which you create the final invoice – requires the following fields:

    API Name Description
    ON_Type Must be set to Final in order to create the final invoice.
    ON_ProformaInvoice Lookup the related deposit invoice.

    For details, see Adding Deposit Invoice Fields to Source Objects.

  2. Relate the deposit invoice with the second source object.

    The lookup field ON_ProformaInvoice on the second source record must point to the deposit invoice created from the first source record.

    According to your project requirements, this relation can be set

    • automatically using a dedicated custom process (or an additional action in the deposit invoice closing process)
    • automatically using other automation means on record creation, depending on the involved object
    • manually through user input

Other required tasks include:

Workflow outline

Once set up, the solution may work as follows:

deposit_2_sources
Creating deposit invoice and final invoice from different sources

(1) JustOn generates a deposit invoice if the field ON_Type on the first source record is set to Deposit. Using the fields ON_DepositRate or ON_DepositAmount, you set the price of the deposit line item to be created. The field ON_ProformaInvoice on the source record points to the deposit invoice.

On payment registration, JustOn assigns the corresponding payment balance to the deposit invoice.

(2) When appropriate, you close the deposit invoice. In particular, this

  • unassigns the payment balance from the deposit invoice, and
  • creates the lookup between the second source record and the deposit invoice, that is, sets ON_ProformaInvoice on the second source record.

(3) With both ON_Type set to Final and ON_ProformaInvoice pointing to the deposit invoice on the second source record, JustOn generates the final invoice. It registers the payment balance, which has been previously unassigned from the deposit invoice, with the final invoice. Doing so reduces the final payment amount.

Enabling Dunning Reminders for Deposit Invoices

By default, pro forma invoices and deposit invoices are exempt from dunning processes. If your business, however, requires issuing reminders for pro forma invoices or deposit invoices, you must explicitly enable this option using the corresponding global setting Allow Pro Forma / Deposit Dunnings.

  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 Pro Forma / Deposit Dunnings.
  5. Click Save.