action.skip

Controlling Additional Generic Invoice Run Options

← Billing Arbitrary Objects

The generic invoice run supports a number of additional options to cover specific use cases, including:

Enabling Invoice Run From Parent

You can set up JustOn to allow for manually starting the generic invoice run from a parent of the actual source object. Think, for example, of an account that has multiple contracts (or orders with order products) set up as source objects – now you want to generate an invoice for this account that covers all related contract (or orders).

ir_ON_field_single_o_parent
Invoking invoice creation from a parent object

Generating invoices from a parent of the source object requires the following additional setup tasks:

For details about configuring the source objects, see Setting Up Parent-Child Objects, Setting Up Single Object or Setting Up Data Mapping, respectively.

Creating Parent Invoice Run Filter

To allow for invoking the invoice run from a parent of the actual source object, you need a specifically configured invoice run filter that specifies the parent relationship. To this end, you use the Parent Relationships field of the filter. The value is a JSON string map that specifies the parent relationship. The keys are lookup fields (or formulas to return the ID) that point to the intended parent object, with the parent object type as their values. For example, {"ON_Account__c": "Account"} tells that ON_Account__c is a field on the source object (the filter target) that contains the parent ID of the type Account.

Invoice run from parent - examples

The following examples illustrate possible use cases and the required parent configuration.

Order (as the source object) with two parents

GIR_parent_example_1
Invoking the invoice run from from two parent objects

Assume you want to enable the invoice creation from the account that owns the order as well as from the contract to which the order relates. To this end, you use the known relationships to these parents. Accordingly, your JSON mapping in the Parent Relationships field of the filter may look like

{"ON_Account__c":"Account","ContractId__c":"Contract"}

Order (as the source object) with a parent and a higher-level parent

GIR_parent_example_2
Invoking the invoice run from a higher-level parent

Now assume you want to enable the invoice creation from the parent account of the account that owns the order. This requires

  • Creating a custom field on the order that specifies the relation to the higher-level parent account, like a formula field ON_ParentAccount__c, where the formula may be Account.ParentId.
  • Defining the parent relationship in the filter using the custom field created before, like

    {"ON_ParentAccount__c":"Account"}
    
  1. Click to enter Setup, then 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 Filters.

  3. Create the filter as required.

    The following fields are mandatory:

    Field Description
    Name Specifies the filter name, will be available as an option value when triggering the invoice run. Must be unique.
    Target Specifies the API name of the filter target. Represents the source object based on which the invoice is created.
    Use Case Specifies the specific filter use case. Must be Generic for the generic invoice run.
    Parent Relationships Specifies a parent relationship of the target object. Is a JSON string map where keys are lookup fields (or ID formulas) to the intended parent object, with the parent object type as their values, like {"ON_Account__c": "Account"}.

    Child Relation is required if you create invoices based on source objects that are in a parent-child relationship. Transactional Suffix is required if you use multiple billing configurations with different sets of field configurations.

Configuring Fields to Display on Parent

If you use the invoice build button on a parent object, JustOn displays a table of available source (child) records. You can configure the columns of this table using a field set defined on the source (child) object:

  1. Navigate to field sets of the source object.

    In Salesforce Lightning, click to open the Setup menu and select Setup, then open Objects and Fields > Object Manager > Object > Field Sets.

    In Salesforce Classic, open Setup > Build > Customize > Object > Field Sets for standard Salesforce objects. For JustOn or custom objects, open Setup > Build > Create > Objects > Object, then scroll to the Field Sets section.

  2. Click New.

  3. Specify the name genericinvoicerun.

    Specify the label and description as required.

  4. Click Save.

    This creates the new (empty) field set and opens it in the edit view.

  5. Move the fields you want to be displayed to the In the Field Set container.

    Fields without ON_ prefix on standard objects must be allowlisted in order to be visible in the field set.

  6. Click Save.

    This applies the field set configuration, making the table setup available on the Create New Invoice page.

Configuring Recurring Billing

Your business may require to set up arbitrary objects to be billed repeatedly. That is, you must reproduce the behavior of recurring subscription items in the context of the generic invoice run – without subscription.

To enable recurring billing with the generic invoice run, you add the fields that hold the specific billing information to the source object from which the invoice line items are generated. For details, see General Billing Settings.

Why recurring billing via generic invoice run instead of subscription billing?

Usually, JustOn recommends to create subscriptions and, consequently, to produce invoices based on them when billing recurring items on a contractual, regular basis. So why use the generic invoice run – reproducing the subscription behavior – instead?

Reasons to do so may include:

  • You bill CPQ subscriptions.
  • You use another object to keep all contractual data (like orders, for example) and do not want to add another data maintenance layer.
  • You primarily sell one-time products and rarely bill recurring items.
  1. Navigate to the fields list of the source object.
  2. Create at least the following new fields.

    Field Label API Name Data Type Description
    Billing Type ON_BillingType Picklist
    Formula (Text)
    Specifies the billing behavior. Supported values for recurring items include Recurring, Recurring Prorated and Recurring Prorated AVG.
    If the field does not exist or is empty, it defaults to the billing type One-Time.
    Next Service Period Start ON_NextInvoice Date Specifies the next billing date. If no value is defined, it will be substituted by the maximum of the invoice run start date, subscription start date or item start date. When the invoice is set Open, it is incremented to the current invoice line item's
    service period end date + 1 day
    Start Date ON_StartDate Date
    Formula (Date)
    The start date from which this item is active (may be empty)
    If the referenced field is of the type Date/Time, the operator DATEVALUE must precede the referenced field, like DATEVALUE(<datetime_field>).
    End Date ON_EndDate Date
    Formula (Date)
    The date until which this item is active (may be empty)
    If the referenced field is of the type Date/Time, the operator DATEVALUE must precede the referenced field, like DATEVALUE(<datetime_field>).
  3. Depending on your business requirements, create the following fields in addition.

    Field Label API Name Data Type Description
    Billing Period ON_BillingPeriod Number(2,0) Defines the time interval (in days, months or years) after which the item is considered in the invoice run.
    Billing Unit ON_BillingUnit Picklist
    Formula (Text)
    Defines the time unit for the billing period to be displayed on the invoice and which is used for the price calculation of the billing period. Supported values are Day, Month and Year.
    Sync With ON_SyncWith Picklist
    Formula (Text)
    Specifies a time with which the next invoice date of a recurring item is to be synchronized. Possible values include Start of next year, Start of next fiscal year, Start of next month, Start of next quarter, Start of next fiscal quarter, Start of next half year, Start of next fiscal half year.
    Billing Practice ON_BillingPractice Picklist
    Formula (Text)
    Defines the billing practice for recurring items. Possible values include Advance (to be billed as soon as possible) or Arrears (to be billed at the end of its service period).
    Be aware that source object records with Billing Practice set to Arrears will not be considered when generating bookkeeping data for unbilled revenue (see Bookkeeping Data for Unbilled Revenue).

Enabling Pre-Payment Balance Assignment

For repeated billing (see Recurring Billing), you can have a pre-payment balance automatically assigned to an invoice. JustOn makes use of a specific balance assignment key to make sure that the automatic balance assignment correctly relates the balances with the matching invoices. For details, see Assigning Pre-Payment Balance to Invoice.

To support the balance assignment key with the generic invoice run, you must create the field ON_BalanceAssignmentKey on the source object from which the invoice is generated, and then make sure to have it set on the relevant source records. Subsequently, the balance assignment key is set on the produced invoices.

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

    Field Label API Name Data Type
    Balance Assignment Key ON_BalanceAssignmentKey Text (255)
    Formula (Text)

    For help about creating fields, see Managing Object Fields.

Once the field is set up and filled on the produced invoices, JustOn automatically assigns the matching pre-payment balances on invoice finalization.

Applying Invoice Criterion

Your business may require to group and distribute invoice line items along a specific criterion – only invoice line items with the same criterion are to be included in one invoice, others are invoiced separately. To support this, JustOn makes use of invoice criteria, which are a means for controlling the distribution of invoice line items to multiple invoices.

To enable the invoice criterion, add the field ON_InvoiceCriterion to the source object from which the invoice line items are generated.

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

    Field Label API Name Data Type
    Invoice Criterion ON_InvoiceCriterion Text (255)
    Formula (Text)

    For help about creating fields, see Managing Object Fields.

Using this field allows for grouping invoice line items. The scope of the criterion is limited to draft invoices, the current invoice run, and the service period of the current invoice run.

Info

If empty or not set, the invoice criterion is considered an empty criterion, which, consequently, does not distribute the invoice line items to multiple invoices.

Invoice criterion example

In one generic invoice run, the following custom object records

Account Title Invoice Criterion
My Company Product 1 A
My Company Product 2 A
My Company Product 3 B

produce two invoices with one service period for "My Company" with the following invoice line items:

(1) invoice for criterion A

Invoice Line Item
Product 1
Product 2

(2) invoice for criterion B

Invoice Line Item
Product 3

Hiding Invoice Line Items

Your business may require to hide certain invoice line items from the "visual output" but to still include it in the invoice calculation. To support this, an invoice line item must be of a type like None or Hidden (see Invoice Line Item Types).

To allow setting the invoice line item type in the context of the generic invoice run, you add the field ON_LineItemType to the source object from which the invoice line items are generated.

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

    API Name Data Type
    ON_LineItemType Text (255)
    Formula (Text)

    For help about creating fields, see Managing Object Fields.

Now you can set ON_LineItemType to a type like None or Hidden to hide the resulting invoice line item (see Invoice Line Item Types).

Propagating Associated Documents

During the generic invoice run, JustOn can link documents that are associated to (parent or child) source records with the resulting invoice record. If there are Content Version types defined for the relevant documents and these type are included in the field Email File Types (see Email Attachments), the linked documents are attached to the invoice upon distribution (emailing, etc.) and sent to the corresponding recipient.

To allow a fine-grained control over which (of possibly multiple) documents are linked with the invoice, the setting is made on document basis. To this end, you create the new custom checkbox ON_LinkDocument on the Content Version object.

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

    Field Label API Name Data Type
    Link to Invoice ON_LinkDocument Checkbox
    Formula (Checkbox)

    Your business may require to automatically select the checkbox depending on certain conditions. In this case, create a formula field with the return type Checkbox, where the formula represents the intended logic. Otherwise, create a simple checkbox and let users select it manually.

    For help about creating fields, see Managing Object Fields.

Once the checkbox is selected for a content version record, the corresponding document will be linked with the invoice produced during the generic invoice run.

Enabling Arbitrary Object Billing to 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, however, require billing the same source objects to multiple parties.

To cover these needs, you apply the configuration explained in Enabling Multiple Party Billing:

  1. Create multiple (recipient-specific) sets of ON fields as listed in Setting Up Parent-Child Objects or Setting Up Single Object.

    For details, see Creating Recipient-Specific Controlling Fields.

  2. Create multiple (recipient-specific) invoice run filters as described in Creating Invoice Run Filter.

    For details, see Creating Recipient-Specific Filters.

  3. Optionally, configure the multiple currency billing as required.

    For details, see Configuring Multiple Currency Billing.

Enabling Lookup to Sources

gir_source_lookup With the ON_Invoice field properly set up (see Configuring Parent Object or Setting Up Single Object), JustOn creates lookup relations from the source records to the invoices. Your business may, however, also need lookup relations in the opposite direction – from the invoices to the original source records.

To this end, you create a (formula) ON field for the record ID on the source object and a (correspondingly named) target field on the invoice. Assuming you create invoices from orders, you create ON_OrderID on the Order object and the Invoice object.

This will insert the order ID to the ON_OrderID field on the order, and, on invoice creation, copy the ID value to the corresponding ON_OrderID field on the invoice – producing a lookup relation from the invoice to the original order.

  1. Navigate to the fields list of the source object ( Order).
  2. Create the following new field.

    API Name Data Type Description
    ON_<source>ID
    ON_OrderID
    Formula (Text) Specifies the source record ID, using the API name of the ID field Id.
  3. Navigate to the fields list of the Invoice object (ONB2__Invoice__c).

  4. Create the following new field.

    API Name Data Type Description
    ON_<source>ID
    ON_OrderID
    Lookup (<source>)
    Lookup (Order)
    Links to the related source record.

    For help about creating fields, see Managing Object Fields.

Displaying Usage Data

Your business may require to display usage data on an invoice produced by a generic invoice run. Assume you do not need to actually calculate the usage data – you just want some additional records to be listed as "parts" that make up an invoice line item. That is, you do not rely on proper usage data billing.

Ideally, you hold the usage data using a dedicated object that is a child to the object used to produce the invoice line items. Including the relevant records in the transaction table requires the following configuration tasks:

  • Adding an invoice lookup and the ON_AddToTransactionTable checkbox to the usage data object
  • Creating a flow that sets the invoice on the usage data records
  • Configuring the Transaction Records field on the relevant template

Proceed as follows:

  1. Create an invoice lookup on the usage data object.

    API Name Data Type Description
    ON_Invoice Lookup (Invoice) Links the usage data record to the related invoice.
  2. Add the ON_AddToTransactionTable checkbox to the usage data object.

    API Name Data Type Description
    ON_AddToTransactionTable Checkbox Determines whether to show the usage data record on the invoice.
    Must be selected.
  3. Create a flow to fill ON_Invoice on the usage data records.

    Configure the flow according to your needs, for example, like:

    Flow Element Option Value
    Start Object <invoice_line_item_source>
    Trigger A record is created or updated
    Conditions All Conditions Are Met (AND)
    ON_Invoice__c Is changed {!$GlobalConstant.True}
    Action Action Update Related Records
    How to Find Records Update records related to the <invoice_line_item_source> record that triggered the flow
    Select Related Records {!$Record.<usage_data_object>__r}
    Set Field Values ON_Invoice__c{!$Record.ON_Invoice__c}

    Once set up, this flow will copy any new or changed value from ON_Invoice on the invoice line item source record to ON_Invoice on the usage data record.

    For help about creating flows, see Flows in the Salesforce Help.

  4. Configure the Transaction Records field on the relevant invoice template to display the usage data as required.

    Specify at least the following keys:

    Key Data Type Description
    active Boolean If set true, activates the current configuration.
    title String Specifies the text to be printed above the transaction table.
    name String Specifies the API name of the usage data object.
    fields List of strings A comma-separated list of field API names that specify the transaction table columns and their order to be rendered.

    For details, see Displaying Transaction Records on Invoices.

Once set up as required, this triggers JustOn Billing & Invoice Management to create the usage data table and print it to the invoice PDF.