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

Disabling Manual Invoice Status Modification

Invoices are supposed to be finalized using the Finalize functionality. Finalizing invoices sets them to Open, sets a unique final invoice number, and generates the PDF documents to be sent out.

To prevent users from accidentally (or incorrectly) changing the invoice status manually, you set the Status field to Read-Only.

  1. Navigate to the object management settings of the Invoice object.
  2. Click Page Layouts.
  3. In the Invoice Layout row, click Edit.
  4. Click next to the Status field to open the field properties.
  5. Select the Read-Only checkbox.
  6. Click OK to save the field properties.
  7. Click Save to save the modified page layout.

    For help about modifying page layouts, see Managing Pages.

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

Info

The Create Credit field set is available as of JustOn 2.54.

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

Enabling Draft PDF Generation

For review or testing purposes, your business may require to generate PDF files from multiple invoices in the status Draft. Setting up this feature involves two tasks:

Creating Draft PDF File Distribution Target

To enable the option for creating PDF files for draft invoices, create a dedicated file distribution target for draft PDF documents:

  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 File Distribution.

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

    Make sure to select the checkbox Draft Folder. Other mandatory information include the name, backend and PDF name.

    For details, see File Distribution Information.

  5. Click Save.

Adding Create Draft PDFs Button

To enable the option for creating PDF files for multiple draft invoices from the invoices list view, add the Create Draft PDFs 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 List View.
  4. In the Custom Buttons section, move Create Draft PDFs to the Selected Buttons column.
  5. Click Save to save the modified page layout.

To enable the option for creating PDF files for multiple draft invoices from the invoice run detail view, add the Create Draft PDFs 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 to open the list properties.
  5. Open the Buttons section.
  6. Move Create Draft PDFs 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.

Return to JustOn Administration.

JustOn can generate public links to the produced 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 PDF Preview URL Field

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

Info

As opposed to the ContentDownloadUrl field, the ContentDistributionUrl field provides a link to a preview page instead of a link for downloading the PDF file.

The ContentDistributionUrl field is available as of JustOn 2.50.

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

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

    For help about creating fields, see Managing Object Fields.

Creating PDF Download 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 ContentDownloadUrl on the Invoice object.

Info

As opposed to the ContentDistributionUrl field, the ContentDownloadUrl field provides a link for downloading the PDF file instead of a link to a preview page.

The ContentDownloadUrl field is available as of JustOn 2.57.

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

    API Name Data Type Description
    ContentDownloadUrl 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 Cancelation 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 JustOn Support.

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 JustOn Support.

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.

Info

Regenerating the invoice PDF does not constitute a suitable means to correct an invoice. In case of wrong billing data or formal invoice errors, you usually cancel the invoice, correct the source data as necessary, and then recreate the invoice.

For details, see How to correct an invoice.

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.

Enabling VAT Number Validation

The EU provides a VAT number validation service. It allows to validate the VATIN (value added tax identification number) of businesses in the EU.

Note | Important Info

The EU VAT number validation service is accessed via an insecure HTTP request. Please be aware of this fact before using the service.

JustOn uses this service to check the VAT number of an account. The VAT check can be performed

  • Individually for a single account, using a button on the account page, or
  • For multiple accounts using a scheduled batch job.

Info

The VAT number check is available as of JustOn 2.57.

VAT validation concepts

By default, JustOn's VAT validation uses the VAT number as specified in the VATIN field of the account as the source field. You can, however, overwrite this behavior by creating a custom field ON_VATNumber on the Account object. Once this field exists, JustOn uses this field as the source. In order to validate the VAT number, the source field must not be empty.

The result of the VAT validation is written to fields on the Account object:

Field Label API Name Data Type Description
VAT Number Valid VATIsValid Checkbox Selected if the VAT number is valid
VAT Validated Name VATValidatedName Text (255) The name linked to the VAT number
VAT Validated Address VATValidatedAddress Long Text Area (32768) The address linked to the VAT number
Last VAT Validation VATLastValidation Date/Time The timestamp of the last validation
Last Successful VAT Validation VATLastValidationSuccess Date/Time The timestamp of the last successful validation
Last VAT Validation Error VATLastError Text (255) The error message if the last validation was not successful

Note

The VAT validation only tells whether a given EU VAT information exists. It does not necessarily prove, however, that the given VAT number actually belongs to the current account.

Be aware of the following validation specifics:

  • If the validation was not successful, only the fields Last VAT Validation and Last VAT Validation Error are updated.
  • The fields VAT Number Valid, VAT Validated Name and VAT Validated Address reflect the result of the last successful validation.
  • Modifying the value in the VAT number source field (VATIN or ON_VATNumber) does not automatically update the VAT validation result fields. JustOn therefore recommends to delete the validation result fields after changing the VAT number.
  • Empty VAT number source fields (VATIN or ON_VATNumber) produce an error on manual VAT number check, prompting the user to specify a value, and make JustOn skip the corresponding accounts on automatic VAT number validation.
  • The name and address linked to a VAT may not be available.
  • If required, you can add the fields to the page layout of the Account object.

Info

JustOn provides the remote site setting CheckVatService, which is required to access the VAT number validation service.

Enabling the VAT validation in JustOn involves the following tasks:

Activating CheckVatService Remote Site

JustOn provides the remote site setting CheckVatService, which is required to access the VAT number validation service. To activate the remote site:

  1. In Setup, open Remote Site Settings.

    In Salesforce Lightning, navigate to Security > Remote Site Settings.

    In Salesforce Classic, navigate to Security Controls > Remote Site Settings.

  2. Click Edit in the row of CheckVatService.

  3. Select the Active checkbox.
  4. Click Save.

Adding VAT Validation Fields to Account

The VAT validation allows to use the custom field ON_VATNumber on the Account object to provide the VAT number, instead of the default VATIN field.

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

    API Name Data Type Description Example value
    ON_VATNumber Text (255)
    or
    Formula
    Specifies the VAT number. If configured as a formula, it can determine the value based on other fields. DE1234567
    MyVATNumber__c

Using the timestamp fields Last VAT Validation and Last Successful VAT Validation, you can, optionally, create a formula field (VATValidCheck) on the Account object that shows if the validation result is up to date. This field can be used, for example, for an Account list view filter.

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

    API Name Data Type Description
    VATValidCheck Formula (Checkbox) Shows if the validation result is up to date

    Use the following formula:

    IF(
      AND(
        NOT(ISBLANK(ONB2__VATLastValidation__c)),
        NOT(ISBLANK(ONB2__VATLastValidationSuccess__c)),
        ONB2__VATLastValidation__c == ONB2__VATLastValidationSuccess__c
      ),
      true,
      false
    )
    

For help about creating fields, see Managing Object Fields.

Enabling Individual VAT Number Validation

To enable the individual VAT number check for a single account, you add the VAT Validation button to the Account page layout.

Adding the button involves two steps:

  • Creating the button
  • Adding the button to a page layout

To create the button:

  1. Navigate to the object management settings of the Account object.
  2. Click Buttons, Links, and Actions.
  3. Click New Buttons or Link.
  4. Create the following button, then click Save.

    Detail Value
    Label VAT Validation
    Display Type Detail Page Button
    Behavior Display in existing window without sidebar
    Content Source Visualforce Page
    Content VATValidation [ONB2_VATValidation]

    For help about creating buttons, see Managing Buttons or Links.

To add the button to the page layout:

  1. Navigate to the object management settings of the Account object.
  2. Click Page Layouts.
  3. In the Account Layout row, click Edit.
  4. Add the VAT Validation 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.

Enabling Automatic VAT Number Validation

JustOn allows to schedule a job for validating the VAT number of multiple accounts automatically. For accounts to be considered by the job, the VAT number source field (VATIN or ON_VATNumber) must not be empty. That is, accounts for which the VAT number source field is not set are skipped, but no error is produced.

VAT Validation Custom Setting

The VAT validation job is controlled by the custom setting VAT Validation.

Field Name API Name Data Type Description
Validity Period ValidityPeriod__c Number(18,0) The validity period of the VAT validation result in days. Defaults to 0 if empty. If 0, the VAT validation batch job validates only VAT numbers that are not yet validated.
  • If there is no VAT Validation setting record with the name Default, or if the validity period is 0, JustOn executes the VAT number validation only for accounts that are not yet validated, that is, for which the field Last Successful VAT Validation is not set.
  • If there is a validity period specified, the job refreshes the VAT number validation of accounts for which the last check was performed more than the specified number of days ago.

To configure the VAT Validation job, you define a VAT Validation setting named Default:

  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 VAT Validation.

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

    • Name: Default
    • Validity Period: The validity period of the VAT validation result in days
  5. Click Save.

Scheduling VAT Validation Job

You can set up a job in order to have VAT numbers validated automatically on a regular basis. To schedule the VAT validation, you can use either JustOn's Scheduled Jobs page, Salesforce's Schedule Apex functionality or the Force.com Developer Console. For details, see Scheduling a Job.

Via JustOn's Scheduled Jobs page:

  1. Open the Scheduled Jobs page.

    Use the following URL https://login.salesforce.com/apex/ONB2__JobsSetup, or, if you are already logged in, append apex/apex/ONB2__JobsSetup to your org's domain name.

    As of JustOn 2.52, you can access the Scheduled Jobs page via the JustOn configuration app (App Launcher > JustOn Configuration > Jobs Setup).

  2. From the Apex Job drop-down list, select VAT Validation Job.

    The Job Name field is automatically set to BatchVATValidationJob.

  3. From the Start Time drop-down list, select the preferred execution time.

  4. Optionally, edit the displayed cron expression to adjust the execution time.
  5. Click Schedule.

    This sets up the VAT validation to be executed at the specified time. For accounts to be considered by the job, the VAT number source field (VATIN or ON_VATNumber) must not be empty.

Info

From the Scheduled Jobs page, you can also run the job 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: VATValidationChain
    • Apex Class: VATValidationChain
    • 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 VAT validation to be executed at the specified time. For accounts to be considered by the job, the VAT number source field (VATIN or ON_VATNumber) must not be empty.

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

You can also invoke the VAT validation using the following code in the Force.com Developer Console (see Developer Console Functionality in the Salesforce Help):

new ONB2.ChainRunner()
.execute(
    new ONB2.ChainFactory().getByName('VATValidationChain')
);

Defining Initial Invoice Count

Invoices, credits, cancellations and dunning reminders must have unique numbers to comply with legal regulations. In Draft status, these numbers are temporary and of no legal relevance. When finalizing invoices or dunning reminders, however, JustOn creates the unique and unalterable numbers based on defined counters.

Counter and number range concepts

JustOn implements counters using the custom setting Counters. The following fields are available:

Field Possible Values Description
Name Specifies the name of the counter, is to be referred to by the template.
Reset YEARLY
MONTHLY
DAILY
Defines the interval after which the counter is reset. If empty, the counter is not reset.
Template [Year]
[Month]
[Day]
[AccountNo]
{00000}
Specifies the pattern of the produced number. It may contain all custom placeholders, like [Year], [Month], [YearShort], [MonthShort], [Day] or [AccountNo], and must define the number of digits like {00000}. You can combine the placeholders and add any fix strings as necessary.
Use Account Counters (checkbox) true
false
If checked, creates a new number range for each account that uses this counter.

The default counter as shipped with JustOn, for example, uses the following pattern template:

[Year]{00000}

This produces invoice numbers of the following pattern:

201700001, 201700002, 201700003

The count increases each time an invoice is set Open and a new invoice ID is created.

Each counter is associated to one or more number ranges. Number ranges are implemented as a custom object. They represent the groups of numbers to which the unique numbers created for an invoice, dunning reminder etc. belong. If a number range as required by the counter does not exist, JustOn creates one automatically with the count set 0.

Info

Your business may require to start your invoices count with a given number. To this end, you create a number range for invoices that defines the intended start count before actually generating and finalizing invoices.

With the counter field Reset set to YEARLY, JustOn creates a new number range for each year. Likewise it creates a new number range for each month if Reset is set MONTHLY, and every day if Reset is set DAILY. The reset feature can be combined with the setting Use Account Counters.

JustOn selects number ranges based on the counter defined for the invoice, the account of the invoice and the invoice date for day/month/year.

Number ranges include the following fields:

Field Description
Counter Name Specifies the name of the associated counter.
Counter Shows the current count for this number range. Equals the number of the last invoice.
Year Shows the year for this number range. Is empty if the counter is set to not reset.
Month Shows the month for this number range. Is empty if the counter is set to not reset or set to reset YEARLY.
Day Shows the day for this number range. Is empty if the counter is set to not reset or set to reset YEARLY or MONTHLY.
Account Shows the account for this number range. Is empty if the checkbox Use Account Counters on the counter is not selected.

By default, JustOn provides the following counters:

  • Default: A single counter used by default for generating all invoice, credit, cancellation or dunning IDs. This counter is assigned to the default invoice template.

    If you have more than one template or template details to cover specific needs, you can use an individual counter with each template or template detail. To this end, configure additional counters. If you use the dunning functionality, for example, configure a dunning counter first and assign it to the corresponding template detail.

    If the template or template detail does not define a counter, JustOn falls back to the counter set on the tenant. If the system cannot find a valid counter, it shows an exception.

  • Dunning Run: Used to count the individual dunning runs. The dunning run counter does not offer the reset feature and does not work with placeholders.

  • Subscription: Used to count the subscriptions. The subscription counter does not offer the reset feature and supports only a limited set of placeholders (account-related and built-in).

Irrespective of the counter to be used, your business may require to start your invoices count with a given number. To this end, you create a number range for invoices that defines the intended start count before actually generating and finalizing invoices.

  1. Open the Number Ranges tab.
  2. Click New.
  3. Specify the details as necessary.

    • Counter Name: The name of the associated counter
    • Counter: The number preceding the intended start count, like <start_count> - 1

      Assume the invoices you produce are to start with the counter 1000. In this case, set 999 in the Counter field of your number range.

  4. Click Save.

You can provide invoice recipients the option to directly pay their invoices. To do so, you integrate with payment service providers via the JustOn Self-Service Extension.

Once set up, JustOn creates a link to the payment page for a given invoice. You usually add this link to the invoice email in order to redirect your users to the payment page.

Your business may, in addition, require to make this link available on the detail page of an invoice record. To this end, you add a custom formula field to the Invoice object that assembles the payment link.

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

    Field Data Type Formula Notes
    Payment Link Formula (Text) "https://<server>/checkout/ONBSE1__Payment?id=" + Id + "&uuid=" + ONB2__UUID__c Replace <server> with the base URL of your Salesforce instance, like eu09.salesforce.com.

    For help about creating fields, see Managing Object Fields.

Return to JustOn Administration.