Skip to content

Setting Up Invoice Management Options

JustOn allows for a number of advanced features with respect to managing invoices and invoice line items, including

Enabling Template Text Copies

Depending on your organization's requirements, you must modify the texts for individual invoices, that is, without applying the changes to the invoice template. To this end, JustOn provides can copy the text field contents of a template to a draft invoice. To enable this option, add the Copy Text button to the invoice detail view.

  1. Navigate to the object management settings of the Invoice object.
  2. Click Page Layouts.
  3. In the Invoice Layout row, click Edit.
  4. Add the Copy Text button to the page layout.

    In Salesforce Lightning, drag the button from the Mobile & Lightning Actions palette to the Salesforce Mobile and Lightning Experience Actions section.

    In Salesforce Classic, drag the button from the Buttons palette to the Custom Buttons area.

  5. Click Save.

    For help about modifying page layouts, see Managing Pages.

Next Steps:

Editing Invoice Information

Return to JustOn Administration.

Setting Up Credit Generation

JustOn allows for creating credits for existing invoices to be reversed. Setting up this feature involves these tasks:

Enabling Credit Creation for Single Invoices

To enable the option for individually creating a credit based on an invoice, add the Create Credit button to the invoice detail view. To do so:

  1. Navigate to the object management settings of the Invoice object.
  2. Click Page Layouts.
  3. In the Invoice Layout row, click Edit.
  4. Add the Create Credit button to the page layout.

    In Salesforce Lightning, drag the button from the Mobile & Lightning Actions palette to the Salesforce Mobile and Lightning Experience Actions section.

    In Salesforce Classic, drag the button from the Buttons palette to the Custom Buttons area.

  5. Click Save to save the modified page layout.

    For help about modifying page layouts, see Managing Pages.

Configuring Create Credit Fields

To configure which invoice line item fields are displayed when creating a credit for a single invoice:

  1. Navigate to the field sets definition of the Invoice Line Item object.

    In Salesforce Lightning, navigate to Setup > Object Manager > Invoice Line Item > Field Sets.

    In Salesforce Classic, navigate to Setup > Create > Objects > Invoice Line Item > Field Sets.

  2. Click Edit in the Create Credit row.

  3. Move the fields to or from the In the Field Set container and reorder them as required.
  4. Click Save.

Enabling Credit Creation for Multiple Invoices

To enable the option for creating credits for multiple invoices via a batch job from the invoices list view, add the Create Credits button to the invoices list view. To do so:

  1. Navigate to the object management settings of the Invoice object.
  2. Click Search Layouts.
  3. Click Edit in the row of the Invoices List View.
  4. In the Custom Buttons section, move Create Credits to the Selected Buttons column.
  5. Click Save to save the modified page layout.

To enable the option for creating credits for multiple invoices via a batch job from the invoice run detail view, add the Create Credits button to the invoice run detail view. To do so:

  1. Navigate to the object management settings of the Invoice Run object.
  2. Click Page Layouts.
  3. Click Edit in the row of the Invoice Run Layout.
  4. Scroll to the Invoices list and click wrench to open the list properties.
  5. Open the Buttons section.
  6. Move Create Credits to the Selected Buttons column.
  7. Click OK to save the list properties.
  8. Click Save to save the modified page layout.

    For help about modifying page layouts, see Managing Pages.

Next Steps:

Creating Credits

Return to JustOn Administration.

Setting Up Invoice Line Item Mass Editing

JustOn allows for editing multiple invoice line items at once ("mass edit"). Setting up this feature involves two tasks:

Adding the Mass Edit Button

To enable the option for editing multiple invoice line items, add the Edit All button to the invoice line item section of the invoice page layout. To do so:

  1. Navigate to the object management settings of the Invoice object.
  2. Click Page Layouts.
  3. In the Invoice Layout row, click Edit.
  4. Scroll to the Invoice Line Items list and click wrench to open the list properties.
  5. Open the Buttons section.
  6. Move Edit All to the Selected Buttons column.

    rel_list_prop
    Adding the Edit All button

  7. Click OK to save the list properties.

  8. Click Save to save the modified page layout.

    For help about modifying page layouts, see Managing Pages.

Configuring Mass Edit Fields

To configure which invoice line item fields are available for mass editing:

  1. Navigate to the field sets definition of the Invoice Line Item object.

    In Salesforce Lightning, navigate to Setup > Object Manager > Invoice Line Item > Field Sets.

    In Salesforce Classic, navigate to Setup > Create > Objects > Invoice Line Item > Field Sets.

  2. Click Edit in the Edit All row.

  3. Move the fields to or from the In the Field Set container and reorder them as required.

    Make sure to keep all mandatory fields in the field set (Title, Quantity, Unit Price, Tax Rate).

  4. Click Save.

Return to JustOn Administration.

Enabling Settlement

In order to enable the settlement of open invoices or credits, 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 checkboxes Settle Credits or Settle Invoices as required.
  5. Click Save.

    This activates the batch job for the automatic settlement and enables the manual settlement.

Info

JustOn executes the settlement job with the invoice run. The job automatically settles credits against invoices with a positive balance, and invoices against credits with a negative balance.

Return to JustOn Administration.

JustOn can generate public links to the produced invoice PDF files. This allows you to share the documents with any users, including outside your organization, without password protection or any other restrictions.

Note

For generating public links, the Salesforce features Content Deliveries and Public Links must be enabled. For details, see Set Up Content Deliveries in the Salesforce Help.

Enabling the public file link generation for invoice PDF files involves the following tasks:

Enabling Content Distribution

In order to enable public file link generation, you activate the corresponding global setting.

  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 Always Create Content Distribution.
  5. Click Save.

    This enables the public file link generation without installing additional software.

Creating Content Distribution URL Field

For integrations with external systems like customer portals, etc., you can make JustOn write the public PDF file link to the invoice record upon finalization. To this end, create the custom field ContentDistributionUrl on the Invoice object.

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

    Object API Name Data Type Description
    Invoice ContentDistributionUrl URL Specifies the public link to the PDF file.
    Make sure to grant edit access for all users who finalize invoices.

    For help about creating fields, see Managing Object Fields.

Return to JustOn Administration.

Enabling Gross Invoicing

Depending on your business or legal requirements, the nature of your products, etc., you must create net invoices, gross invoices or both of them. This behavior is controlled using the checkbox Gross Invoice.

If the checkbox is selected (the value set true), the unit prices of the invoice line items are considered gross prices. That is, JustOn deducts any applicable taxes from the unit prices.

  • Up to JustOn 2.49, the checkbox is to be set on the invoice. That is, you decide whether to generate a net or gross invoice on the invoice level for all included invoice line items.
  • As of JustOn 2.50, you can set the checkbox individually on each invoice line item. This allows to specify whether to generate net invoices, gross invoices or mixed net/gross invoices.

Info

Use the ON field mechanism, Salesforce processes or other automation tools to have this checkbox set automatically when generating invoices and invoice line items.

Return to JustOn Administration.

Enabling Invoice Rounding

Some countries, like Switzerland or Sweden, have removed low-denomination coins from circulation. In these countries, payable amounts are rounded to the nearest multiple of the minimum currency unit available - either for cash transactions only, or for both cash and electronic transfers.

Invoice Rounding Implementation

If your business requires invoice rounding, you can define rounding rules for a currency using the custom setting Currency Mapping.

Each record can hold the following information:

Field Data Type Description
Name Text (3) Specifies the ISO currency code.
Currency Sign Text (5) Specifies the currency symbol.
Activate Rounding Checkbox Controls whether the grand total of invoices in this currency is to be rounded.
Rounding Method Text (128) The method used for rounding the grand total of invoices. Available values include NONE, FLOOR, CEILING, DOWN, UP, HALF_DOWN, HALF_UP, HALF_DOWN_ZERO, HALF_UP_ZERO, HALF_EVEN.
The default rounding method is NONE.
For details, see, for example, RoundingMode.
Rounding Precision Number (13,5) Controls the precision for the rounding difference.
0.05 rounds to 5 cents, 1.00 rounds to whole euros.
Example configuration for Swiss currency rounding

In Switzerland, invoice amounts are rounded to 0,05 francs according to the following common rounding rules:

1,000 - 1,024 1,00
1,025 - 1,074 1,05
1,075 - 1,099 1,10

That is, to support the invoice rounding for Switzerland, you need the following currency mapping setting:

Field Value Description
Name CHF The ISO currency code for Swiss francs.
Currency Sign SFr. The currency symbol for Swiss francs.
Active Rounding Activates the invoice rounding.
Rounding Method HALF_UP Rounds towards the nearest neighbor according to the defined precision, unless both neighbors are equidistant, in which case rounds up.
Rounding Precision 0.05 Rounds to 5 rappen.

When applying invoice rounding, JustOn automatically creates a special invoice line item of the type Rounding Difference. This line item contains the value needed to round the grand total according to the rules defined in the currency mapping. On the invoice PDF, the rounding difference is printed between the tax rates and the grand total.

Info

Depending on your locale or your business, you may need to modify the display name for the rounding difference. To do so, edit the custom label Rounding Difference. For help about modifying custom labels, see Managing Custom Labels.

Defining Invoice Rounding Settings

To create invoice rounding 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 Currency Mapping.

  3. Click New.
  4. Specify the information as necessary.
  5. Click Save.

    This creates the new currency mapping record.

Info

Create a record for each currency for which you want invoice amounts to be rounded.

Modifying Invoice Cancellation Reasons

Depending on your business requirements, you may have to add new or remove unnecessary cancellation reasons. To this end, you edit the value picklist for the Cancelation Reason field of the Invoice object.

  1. Navigate to the Cancelation Reason field of the Invoice object.
  2. In the Values section, modify the picklist values as necessary.

    • To create a new value, click New.
    • To edit an existing value, click Edit in the row of the value to be edited.
  3. Specify the details as required, then click Save.

  4. To delete a value, click Del in the row of the value to be removed, and confirm the operation.

    For help about editing fields, see Managing Object Fields.

Controlling Email Tracking Options

To help tracking the invoice distribution, JustOn creates a history task for sent invoice emails. These tasks are created as Activity records on the related invoice.

JustOn saves the past activity by default when emailing invoices. The Activities list, however, is not visible on the invoice page by default. To enable the Activities display:

  1. Open an invoice.
  2. Click to open the Setup menu, then select Edit Page.
  3. Drag the Activities component to the intended region of the page.
  4. Click Save.

    For help about modifying pages, see Managing Pages.

Disabling Email Tracking

If you do not want these email tracking activities to be created, you can disable this functionality. To do so:

  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. Deselect the checkbox Track E-Mail.
  5. Click Save.

Setting Up Finalization or Cancellation Using Processes

Your organization's business may require to finalize or cancel invoices automatically when certain conditions become true. To this end, JustOn provides the specific Apex class InvoiceStatusChange, which you can use to set up according processes. Depending on your use cases, you can pass the following arguments to the Apex class:

Apex Variable Value Description
Cancel Creates a draft cancellation invoice and sets the status of the original invoices to Canceled.
Finalize Finalizes the involved invoices, setting the status to Open.
Cancel + Finalize Creates a cancellation invoice that refers to the original invoice, finalizes the cancellation invoice and sets the original invoice to Canceled.

Assume the following example: You create (draft) invoices from opportunities (see Enabling Opportunity Billing) when they are Closed Won. Now you lose an opportunity, and you must cancel the corresponding invoice. You want this to happen automatically when you set the opportunity stage to Closed Lost.

Following this example, you need a lookup field on the Opportunity object that refers to the generated invoice.

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

    Field Data Type Description
    Invoice Lookup (Invoice) Shows the invoice that has been created for this opportunity

    For help about creating fields, see Managing Object Fields.

Then you 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 name and an API name as required.
  4. Set the process to start when A record changes.
  5. Click Save.
  6. Select the object ( opportunity) whose modifications are to change the invoice status.
  7. Set the process to start when a record is created or edited.
  8. Define the process criteria as required.

    • [Opportunity].StageName Equals Closed Lost
    • [Opportunity].StageName Is changed True

    Combine the conditions with logical AND, that is, select All of the conditions are met.

  9. Select Apex as immediate action, and specify the class Change invoice status.

  10. Set the following Apex variables:

    • For the variable "Cancel", "Finalize" or "Cancel + Finalize"?, set the String value Cancel + Finalize.
    • For the variable Invoice Id, set the Field Reference value [Opportunity].Invoice__r.Id.
    • For the variable Cancellation Reason, set the String value to Invoice incorrect (or one of the other available cancellation reason picklist values).
  11. Click Save.

  12. Click Activate.

    This triggers JustOn to execute the process when the opportunity is set Closed Lost: It creates a Cancellation invoice that refers to the original invoice, finalizes the cancellation invoice and sets the original invoice to Canceled.

Note

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

Info

For help with setting up processes, see Create a Process in the Salesforce Help, or contact the JustOn support team.

Setting Up Automatic Draft Invoice Deletion

Certain use cases may require to delete draft invoices based on given criteria.

As an example, assume you use the continuous invoice run to produce invoices as early as possible and to update them when required - there may be changes to the account (like a new address or bank account), to the subscription (a new item) or to the source object. These modifications may invalidate the information on already created draft invoices, which therefore must be deleted. The next continuous invoice run then regenerates the previously removed draft invoice with the correct information.

To this end, JustOn provides the specific Apex class DraftInvoiceRemover, which you can use to set up a process to delete invalidated draft invoices.

Note

Be aware that the draft invoice remover only deletes invoices that are associated with an invoice run.

Process details
  • JustOn executes the draft invoice remover when the criteria of the process are met.
  • The remover determines all draft invoices that are related to the records in the scope of the process.
  • The remover queues the delete job for the draft invoices.
  • The delete job is executed until all respective invoices are deleted.
  • The number of jobs equals the number of invoices divided by the batch scope.
  • You can monitor the jobs on the Apex Jobs page in Setup.
  • The job sends an email that lists all invoices that could not be deleted. You must delete these invoices manually.

Setting Up Draft Invoice Remover Process

Set up the draft invoice remover 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 name and an API name as required.
  4. Set the process to start when A record changes.
  5. Click Save.
  6. Select the object ( account, subscription or the source object) whose modifications are to trigger the draft invoice deletion.

    • The object must be referred to by the invoice with an ID field (lookup or formula with CASESAFEID()), that is, a parent relationship, like account or subscription.
    • The object must refer to the invoice with an ID field (master-detail, lookup or formula with CASESAFEID()), that is, a child relationship, like case, order, or a custom source object.
  7. Set the process to start when a record is created or edited.

  8. Define the process criteria as required.

    To monitor, for example, the bank account of an account and have the corresponding invoices deleted if that changes, use:

    [Account].ON_BankAccount__c Is changed True

    Combine multiple conditions with logical AND or OR, depending on your use cases.

  9. Select Apex as immediate action, and specify the class Remove draft invoices.

  10. Set the following Apex variables:

    • For the variable Is Parent: Set True for all parent relationships, set False for all child relationships.
    • For the variable Lookup Field Name: Set String and specify the API name of the ID field, which is located on the invoice for parent relationships ( Account__c for the Account object), and on the child object for child relationships ( ON_Invoice__c for a custom source object).
    • For the variable Object Id: Set Field Reference and select the ID field of the object ( Account ID for the Account object).
  11. Click Save.

  12. Click Activate.

This triggers JustOn to execute the process when defined process criteria are met. Following the example, it identifies and deletes draft invoices for an account whose bank account information has been modified.

Info

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

For help with setting up processes, see Create a Process in the Salesforce Help, or contact the JustOn support team.

Configuring Batch Scope

The invoices are deleted by a queueable asynchronous batch process in order to keep the governor limits under control. This also enables bulk operations on parent and child objects with larger batch sizes than a usual invoice deletion would allow.

  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 Batch Settings.

  3. Click New.
  4. Specify the details as necessary.

    • Name: DraftInvoiceRemover
    • Scope: 50
  5. Click Save.

Info

Be aware of the following specifics:

  • The scope depends on the number of objects and relationships. Test the setting to determine the appropriate value. A larger scope may work, but can can produce limit exceptions.
  • Limit exceptions are reported by email. If necessary, reduce the scope accordingly.

Excluding Draft Invoices From Deletion

You can exclude the draft invoices produced in an invoice run from the deletion by the draft invoice remover process. To do so, mark the corresponding invoice run as final.

  1. Open the Invoice Runs tab.
  2. Click the ID of the invoice run whose draft invoices you want to exclude from deletion.
  3. Double-click the Is Final checkbox and select it.

    Alternatively, you can click Edit in the invoice run view and then select the Is Final checkbox.

  4. Click Save.

    This excludes the draft invoices produced by the current invoice run from deletion by the draft invoice remover process.

Enabling Invoice PDF Regeneration

Usually, JustOn generates a PDF file when finalizing an invoice. In certain business use cases, you may need to recreate the PDF file for an already finalized invoice (status Open). Doing so does not modify any invoice data.

To enable the option for individually recreating a PDF file for an open invoice, add the Recreate PDF button to the invoice detail view.

  1. Navigate to the object management settings of the Invoice object.
  2. Click Page Layouts.
  3. In the Invoice Layout row, click Edit.
  4. Drag the Recreate PDF button to the Custom Buttons area in the invoice detail section.
  5. Click Save to save the modified page layout.

    For help about modifying page layouts, see Managing Pages.

Return to JustOn Administration.