Enabling Pro Forma Invoices
Certain business use cases require merchants or suppliers to issue pro forma invoices. Pro forma invoices are commonly used as preliminary invoices with a quotation, for customs purposes, or to give an example of the charged prices. In that sense, the pro forma invoice is exempt from any accounting or payment-related processing.
Enabling pro forma invoices in JustOn involves the following tasks:
- Adding new fields to the source object to hold the required pro forma invoice data
- Configuring pro forma invoice display
- Creating a process for closing the pro forma invoice
Pro Forma Invoice Concepts
Basically, the creation of a pro forma invoice is controlled using the ON field
ON_Type on the source object. If this field is set to
Proforma, JustOn generates a pro forma invoice.
When you use pro forma invoicing, be aware that JustOn does not consider order discounts with the pro forma invoices, but only when generating the final invoices.
Working With Pro Forma Invoices
The following sections describe how to work with pro forma invoices, outlining their life cycle.
Pro Forma Invoice Creation
JustOn generates a pro forma invoice if the field
ON_Type on the source object is set to
Once you have set the field
ON_Type on the source object to
Proforma to trigger the pro forma invoice creation, do not modify this field subsequently to make sure that the pro forma invoicing features operate correctly.
After creating the pro forma invoices, JustOn sets the custom field
ON_ProformaInvoice on the source objects to the pro forma invoices.
Creating a pro forma invoice
Pro Forma Finalization
During invoice finalization a balance of typ
Invoice) is created. This balance type is excluded from the account balance (rollup summary) and the statement of account creation.
Pro Forma Invoice Closure
Before you create the final invoice, you must close the pro forma invoice. There are two ways to do so:
- Using the Close button on an individual invoice
- Using a custom process to be triggered from a source record
Close button or custom process?
The procedure to close the invoices depends on your business use cases and the corresponding data structure in your org.
If you create invoices from a parent record in a parent-child relation, you most likely use a custom process to be triggered from the relevant parent record. The process clears the custom fields
ON_LastInvoiceRun on the parent source record, which allows for creating the final invoice from the same record.
If your invoice run involves multiple source records (for example, using multiple filters or via single source object configurations), the Close button on an individual invoice is the more appropriate approach. It clears the custom fields
ON_LastInvoiceRun on all source records that are related to the current invoice to allow generating the final invoice. This saves the need for manually clearing these fields on the source records.
Using the Close button on an individual invoice clears the custom fields
ON_LastInvoiceRun on all related source records to allow generating the final invoice.
If appropriate, you can use a custom process to be triggered from a source record. Applying the specific Apex class that JustOn provides for this purpose, your process
- sets pro forma invoices to the status
- clears the custom fields
ON_LastInvoiceRunon the source record that triggers the process
- unregisters any assigned payment balances and sets the balance field
RelatedInvoiceto the pro forma invoice
Closing the pro forma invoice via process
Usually, JustOn assigns unregistered pro forma payment balances to the corresponding final invoices. Clearing the field
RelatedInvoice of the unregistered pro forma payment balance will allow to assign the balance to any matching invoice.
Final Invoice Creation
After you have closed the pro forma invoice, you create the final invoice the same way and based on the same source records as the pro forma invoice.
- registers the balances (if any) that were unregistered from the pro forma invoice by the closing process to the final invoice
- sets the field
RelatedInvoiceon the final invoice to the corresponding pro forma invoice
Creating the final invoice, linked to the pro forma invoice
Adding Pro Forma Invoice Fields to Source Objects
In order to hold the required pro forma invoice data, you must add new fields to the source object, which can be
- the Opportunity object in case of opportunity billing, or
- any other object if you use the generic invoice run for billing arbitrary objects.
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 specific suffixes to the ON fields, as explained in Creating Recipient-Specific Controlling Fields.
- Navigate to the fields list of the source object.
Create the following new fields as required.
API Name Data Type Description ON_Type Text (255) Must be set to
Proformain order to create pro forma invoices. Is cleared automatically when the pro forma invoice is closed.
ON_ProformaInvoice Lookup (Invoice) Shows the related pro forma invoice.
API Name Data Type Description ON_CloseProformaInvoice Checkbox Can be used to trigger the process to close the pro forma invoice.
For help about creating fields, see Managing Object Fields.
You can add more fields using the ON field mechanism.
Configuring Pro Forma Invoice Display
Usually, a pro forma invoice needs other texts on the printed document than the final invoice. You can therefore define a template detail - named
Proforma - to provide appropriate texts.
The following fields are relevant on the template and the template detail:
|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.||
|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.
|Deposit Description||Long description of the nature of the deposit||Template|
- Open the template or template detail to be edited.
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.
Creating Process for Closing Pro Forma Invoices
Closing pro forma invoices requires a process that calls the appropriate Apex class provided by JustOn. The process criteria that start the execution depend on your use cases. For example, you can use a custom checkbox field
Close Pro Forma Invoice on the source object to trigger the process when the checkbox is selected.
The source object for the process depends on the object that is used for pro forma invoicing:
- in case of opportunity billing, use the Opportunity object,
- in case of arbitrary object billing, select the corresponding object, for example, Order
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:
In Setup, open Process Builder.
In Salesforce Lightning, navigate to Process Automation > Process Builder.
In Salesforce Classic, navigate to Create > Workflow & Approvals > Process Builder.
- Specify a name and an API name as required.
- Set the process to start when
A record changes.
- Click Save.
- Select the object ( Order or Opportunity) whose modifications are to close the pro forma invoice.
- Set the process to start
when a record is created or edited.
Define the process criteria as required.
[<object>].Close Proforma Invoice
[<object>].Close Proforma Invoice
Combine the conditions with logical AND, that is, select
All of the conditions are met.
Apexas immediate action, and specify the class
Close Proforma Invoice.
Set the following Apex variables:
recordIds, set the
Suffix, set the
Stringvalue to the corresponding recipient-specific suffix.
Suffixis required when using multiple processes for multiple billing configurations.
This triggers JustOn to execute the process when the
Close Pro Forma Invoicecheckbox is selected. It closes the pro forma invoice and prepares the object for creating the final invoice (for details, see Pro Forma Invoice Closure).
Depending on your use cases, the process setup and the objects to involve may vary.
Make sure that closing a pro forma invoice from its detail view using the Close button does not trigger the configured process for closing pro forma invoices from source records. This may produce errors.
Enabling Pro Forma 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.
Create multiple (recipient-specific) sets of ON fields as listed in Adding Pro Forma Invoice Fields to Source Objects.
For details, see Creating Recipient-Specific Controlling Fields.
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 Proforma Merch checkbox
Close Proforma Buy checkbox
Enabling Dunning Reminders for Pro Forma 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 and deposit invoices, you must explicitly enable this option using the corresponding global setting
Allow Pro Forma / Deposit Dunnings.
In Setup, open Custom Settings.
In Salesforce Lightning, navigate to Custom Code > Custom Settings.
In Salesforce Classic, navigate to Develop > Custom Settings.
Click Manage in the row of Global Settings.
- Click Edit in the Default row.
- Select the checkbox
Allow Pro Forma / Deposit Dunnings.
- Click Save.
Return to JustOn Administration.