Billing Arbitrary Objects
← Setting Up Billing Automation
JustOn Billing & Invoice Management allows creating invoices from virtually any object type during an invoice run. Using the generic invoice run, you can completely bypass subscriptions – if you do not need them to model any contractual relations or conditions.
Note
The generic invoice run does not work with Line Item Schedule (OpportunityLineItemSchedule
) records as source. This Salesforce object does not allow accessing other objects (in particular, Opportunity Product) via formula fields, making it impossible to retrieve invoice run-relevant data.
Assume the following scenario as an example: You have integrated Salesforce with your back-end or marketplace system. In this environment, there are generated orders, typically with multiple order products. These order products now need to be invoiced without any contractual situation.
The way to set up the generic invoice run depends on the representation of your source data in Salesforce.
- Parent-child objects
-
Following the example, your source data may be stored in objects that are in a parent-child relationship, for example, orders and order products. In this case, you set up these objects to hold the invoicing data using the ON field mechanism. JustOn can then produce the invoices based on the parent object and the invoice line items out of its child objects.
For details, see Setting Up Parent-Child Objects
- Single objects
-
There may be, however, customized objects that keep all required information in a single record. To support this scenario, you set up this single object to hold all invoicing source data using the ON field mechanism and specifically mark it as the single source. Consequently, JustOn produces both invoices and invoice line items from these records.
For details, see Setting Up Single Object
- Data mapping
-
Furthermore, there may be data in addition to the configured ON fields for source objects in a parent-child relationship or for single source objects. If you need to create invoices based on data that is not accessible otherwise, you set up specific data mappings to retrieve it.
For details, see Setting Up Data Mapping
- Invoice run from parent
-
Irrespective of the source objects and their configuration, you can set up JustOn to allow for starting the generic invoice run from a parent of the actual source object.
For details, see Enabling Invoice Run From Parent
Info
You can combine multiple sources, providing the corresponding setup: You can define which data to use via ON fields, and specify an (optional) data mapping to further refine the invoice creation.
Custom filters finally determine which object records are to be processed in the invoice run.
In addition, the generic invoice run supports a number of options to cover specific use cases.
Once set up, the generic invoice builder is executed as part of the usual invoice run if a corresponding custom filter is selected.
Info
When executing the generic invoice run, JustOn
-
Creates a lookup relation from the billed source record to the produced invoice
To this end, you must properly set up the
ON_Invoice
field (see Configuring Parent Object or Setting Up Single Object). Setting this field marks a record as invoiced, preventing it from being invoiced again.If the produced invoice is canceled, the object records become subject to the invoice run again.
-
Writes information about the billed source record to the generated invoice line items, setting the following fields:
Field Label API Name Data Type Description Source Id SourceId Text(18)(External Id) The ID of the source object. Filter Filter Text(255) The name of the invoice run filter.
Optionally, you can, in addition, have JustOn create lookup relations from the invoices to the original source records (see Enabling Lookup to Sources).
Setting Up Parent-Child Objects
You can generate invoices based on source objects that are in a parent-child relationship, like, for example
- orders with order products
- opportunities with opportunity products
- quotes with quote lines
or other parent-child objects. If set up accordingly, the invoice run takes the parent object ( order) to produce the invoice, and the child objects ( order products) to produce the invoice line items.
Creating invoices based on accordingly configured parent-child objects
The invoicing process requires a number of ON fields on both the parent and the corresponding child object. The configuration steps include:
Info
In case you need multiple billing configurations, for example, if you want to create two invoices for multiple recipients from the same record, JustOn must distinguish between different sets of field configurations. To this end, append specific suffixes to the configuration fields, as explained in Creating Recipient-Specific Controlling Fields.
Configuring Parent Object
- Navigate to the fields list of the parent object.
-
Create the following new fields as required.
Mandatory fields on the parent object:
API Name Data Type Controlling Field Description ON_Account Formula (Text) Specifies the Salesforce account ID or external ID.
The formula uses the API name of the field that links the object to the account, for example,AccountId
.ON_Template Formula (Text) Specifies the Salesforce ID or name of the related template.
The formula can return a dedicated template according to specific criteria – target region, business entity, product group, etc.ON_ServiceDate Formula (Date)
Formula (Date/Time)The record will be invoiced when the date is null
or within the service period of the invoice run.
The formula return type depends on the source field.ON_Invoice Lookup (Invoice) The invoice that resulted from this record.
If the produced invoice is canceled, the object records become subject to the invoice run again.ON_LastInvoiceRun Lookup (Invoice Run) Shows the last invoice run that has processed this object. ON_InvoiceBuildError Text (255) Shows errors that occurred during the last invoice run. Remember that the required ON fields usually reuse (via a formula) data that is already available on the object record.
Optional fields on the parent object:
API Name Data Type Controlling Field Description ON_CreateSingleInvoice Formula (Checkbox)
CheckboxDetermines whether to create a single invoice for each parent record, ignoring existing invoices. ON_IsItem Formula (Checkbox)
CheckboxDetermines whether to add the parent record itself as a line item. Use this if you want to invoice the parent directly without child records. If
ON_CreateSingleInvoice
is configured, the following field on the invoice is mandatory:Object API Name Data Type Description Invoice ON_InvoiceSeparately Boolean Is set during the invoice run. Info
Depending on your use case and its requirements, you may have to copy additional information to the produced invoice. To this end, you add ON fields for the corresponding data to the source object and have the ON field mechanism copy it on invoice creation.
Examples may include:
API Name Data Type Description ON_Tenant Text(255)
Formula(Text)Specifies the associated business entity if different from the account's business entity. ON_EmailContact Lookup (Contact) Shows the related contact.
Note
With the generic invoice run, be careful when setting the type for the invoice and the invoice line items using optional ON fields:
- Use
ON_Type
on the parent object to set the type of the invoice, for example, when generating deposit invoices or pro forma invoices. - Use
ON_LineItemType
to set the type of the invoice line item, for example, to distinguishProduct
fromShipping Fees
.
Configuring Child Object
- Navigate to the fields list of the child object.
-
Create the following new fields as required.
Mandatory fields on the child object (only when utilized):
API Name Data Type Controlling Field Description ON_Title Formula (Text) The name or short description of the invoice line item. ON_Quantity Formula (Number) The quantity to be billed for this invoice line item.
Using a formula, you can, if required, set the quantity0
to exclude records from being invoiced if certain conditions are true.
Assume, for example, a checkboxBillable
- to exclude records where the checkbox is not selected, you can use a formula like:IF(Billable = 'false', 0 , Quantity)
ON_UnitPrice Formula (Currency) Either the net or gross price of one unit of this item. Optionally, the following fields that are mandatory on the parent object can be used on the child object, too:
API Name Data Type Controlling Field Description ON_Invoice Lookup (Invoice) The invoice that resulted from this record. ON_LastInvoiceRun Lookup (Invoice Run) Shows the last invoice run that has processed this object. ON_InvoiceBuildError Text (255) Shows errors that occurred during the last invoice run. Remember that the required ON fields usually reuse data (via a formula) that is already available on the object record.
Info
Depending on your use case and its requirements, you may have to copy additional information to the produced invoice line items. To this end, you add ON fields for the corresponding data to the source object and have the ON field mechanism copy it on invoice creation.
Note
With the generic invoice run, be careful when setting the type for the invoice and the invoice line items using optional ON fields:
- Use
ON_Type
on the parent object to set the type of the invoice, for example, when generating deposit invoices or pro forma invoices. - Use
ON_LineItemType
to set the type of the invoice line item, for example, to distinguishProduct
fromShipping Fees
.
Setting Up Single Object
You can generate invoices based on single source objects that hold all invoicing data using, like, for example, specifically customized contracts. If the object records are marked as the single source (ON_IsItem
= true
), and based on the appropriate configuration, JustOn Billing & Invoice Management produces both invoices and invoice line items from these records.
Creating invoices based on a single object ("IsItem" configuration)
The invoicing process requires a number of ON fields on the source object to hold the information for both the invoices and invoice line items, most notably the ON_IsItem
checkbox (which is why this approach is sometimes called "is item" configuration).
- Navigate to the fields list of the source object.
-
Create at least the following new fields.
API Name Data Type Controlling Field Description ON_Account Formula (Text) Specifies the Salesforce account ID or external ID.
The formula uses the API name of the field that links the object to the account, for example,AccountId
.ON_Template Formula (Text) Specifies the Salesforce ID or name of the related template.
The formula can return a dedicated template according to specific criteria – target region, business entity, product group, etc.ON_ServiceDate Formula (Date)
Formula (Date/Time)The record will be invoiced when the date is null
or within the service period of the invoice run.
The formula return type depends on the source field.ON_Invoice Lookup (Invoice) The invoice that resulted from this record.
If the produced invoice is canceled, the object records become subject to the invoice run again.ON_LastInvoiceRun Lookup (Invoice Run) Shows the last invoice run that has processed this object. ON_InvoiceBuildError Text (255) Shows errors that occurred during the last invoice run. ON_IsItem Formula (Checkbox) If the formula yields true
, forces JustOn to use this object as the source for both the invoice and the invoice line items.ON_Title Formula (Text) The name or short description of the invoice line item. ON_Quantity Formula (Number) The quantity to be billed for this invoice line item.
Using a formula, you can, if required, set the quantity0
to exclude records from being invoiced if certain conditions are true.
Assume, for example, a checkboxBillable
– to exclude records where the checkbox is not selected, you can use a formula like:IF(Billable = 'false', 0 , Quantity)
ON_UnitPrice Formula (Currency) Either the net or gross price of one unit of this item. Remember that the required ON fields usually reuse (via a formula) data that is already available on the object record.
Info
Depending on your use case and its requirements, you may have to copy additional information to the produced invoice. To this end, you add ON fields for the corresponding data to the source object and have the ON field mechanism copy it on invoice creation.
Examples may include:
API Name Data Type Description ON_Tenant Text(255)
Formula(Text)Specifies the associated business entity if different from the account's business entity. ON_EmailContact Lookup (Contact) Shows the related contact.
Note
With the generic invoice run, be careful when setting the type for the invoice and the invoice line items using optional ON fields:
- Use
ON_Type
on the parent object to set the type of the invoice, for example, when generating deposit invoices or pro forma invoices. - Use
ON_LineItemType
to set the type of the invoice line item, for example, to distinguishProduct
fromShipping Fees
.
Setting Up Data Mapping
There may be data in addition to the configured fields for source objects in a parent-child relationship or for single source objects. If you need to create invoices based on data that is not accessible otherwise, you set up specific data mappings to retrieve it.
Creating invoices based on a mapping
A data mapping in JSON notation allows for a more flexible mapping configuration if the ON field mechanism is not sufficient enough. Notably you can
- define constant values for target fields
- define a source field for a target field, even from parent to child
- define a custom invoice line item without dependency to a real source record
- do without ON fields to transfer data to invoices
Note
It is not possible to use a data mapping to create additional recurring invoice line items.
Generating invoices based on a data mapping requires the following setup tasks:
Configuring Source Object
To use a data mapping, the generic invoice builder requires an ON field for the mapping on the source object.
- Navigate to the fields list of the source object.
-
Create one of the following new fields.
API Name Data Type Description ON_MappingName Text (255)
or
Formula (Text)Specifies the name of the file that contains the field mapping definition in JSON.
If configured as a formula field, the mapping name is used for every record.
Deprecated, accessible via the Documents tab in the Salesforce Classic UI only. UseON_MappingId
instead.ON_MappingId Text (255)
or
Formula (Text)Specifies the 18-digit, case-safe Salesforce record ID of the file that contains the field mapping definition in JSON.
If configured as a formula field, the mapping ID is used for every record.ON_Mapping Text Area (Long) Specifies the field mapping definition in JSON.
Make sure to write all JSON code in a single line without spaces.
Takes precedence overON_MappingId
andON_MappingName
.Info
You only need one of the above fields, depending on where you want to store the mapping configuration.
For help about creating fields, see Managing Object Fields.
Creating Mapping Definition
The field mapping is defined in JSON notation and can either be stored as a Salesforce document or directly in a field on the record that is to be invoiced. See also Configuring Source Object.
Info
The data mapping for the generic invoice builder uses the general data mapping structure as described in Using Data Mapping. It considers, however, only the mappings externalIdFields
, fields
and items
, and ignores fieldsToUpdate
and tiers
.
To save the data mapping directly on the object:
- Navigate to the fields list of the source object.
- Click Edit in the row of the
ON_Mapping
field. -
Specify the mapping definition in the text area.
Make sure to write all JSON code in a single line without spaces.
For details about the mapping definition, see Using Data Mapping.
-
Click Save.
This makes the mapping definition available for the invoice builder.
To refer to the data mapping saved as a document:
-
Create the mapping definition and save it as a file.
For details about the mapping definition, see Using Data Mapping.
-
Open the Salesforce Files tab.
- Click Upload Files.
- Select the file using your browser's file selection dialog.
-
Click Done.
This makes the mapping definition available for the object configuration and thus for the invoice builder.
Note
Be aware that you need the Salesforce record ID as the input parameter for
ON_MappingId
.Find the file record ID in the file URL. To retrieve it, click next to the file record, then select View File Details.
Tip
Use a JSON validator before uploading the mapping to Salesforce.
Creating Invoice Run Filter
To define which records to include in the invoice run, you create custom filters.
Info
At least one filter is required.
-
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.
-
Click Manage in the row of Filters.
-
Create filter(s) as required, following the examples below.
Filter Field 1 2 3 4 Name Orders Cases Contracts Custom Object Target Order Case Contract CustomObject__c Child Relation
Plural formOrderItems CustomObject_Items__r Transactional Suffix Cstm Use Case Generic Generic Generic Generic Parent Relationships {"ON_Account__c": "Account"}
The filter name must not exceed 38 ASCII characters. Special characters like brackets will be URL encoded, which makes them count three, like
(
makes%28
.For help about creating filters, see Filters.
Info
-
The
Target
specifies the filter target, that is, the object on which the intended operation is executed. For the generic invoice run, theTarget
represents the source object based on which the invoice is created. -
The
Child Relation
specifies the name of the child object (in plural form) if you create invoice line items based on child records.For standard relations (provided by default between standard Salesforce objects), use the API name of the child object.
For custom relations (to custom objects or those specifically created in your org), use the relationship name (suffixed
__r
) of the child object. Be aware that the UI name may not represent the required API name or relationship name. You can use Workbench (or other data tools) to find the correct name.If you create invoices based on a single source object (
ON_IsItem = true
), the fieldChild Relation
must be empty. -
The
Transactional Suffix
specifies the control field suffix if you use multiple billing configurations with different sets of field configurations, as explained in Enabling Multiple Party Billing. -
The
Parent Relationships
setting is required if you want to invoke the invoice run from a parent of your actual source object – for example, if you want to generate an invoice for an account that has multiple contracts (set up as source objects).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 thatON_Account__c
is a field on the source object (the filter target) that contains the parent ID of the typeAccount
. -
The
Filter Group
specifies a criterion for grouping (invoice run-relevant) filters. If set, users can select a filter group to preselect relevant filters, narrowing down the number of available filters.
Note
The use case for filters must always be Generic
.
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).
Invoking invoice creation from a parent object
Generating invoices from a parent of the source object requires the following additional setup tasks:
- Creating a specific invoice run filter
- Configuring the fields to display on the parent object
- Adding the button for the invoice generation from the parent object
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
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
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 beAccount.ParentId
. -
Defining the parent relationship in the filter using the custom field created before, like
{"ON_ParentAccount__c":"Account"}
-
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.
-
Click Manage in the row of Filters.
-
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:
-
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.
-
Click New.
-
Specify the name
genericinvoicerun
.Specify the label and description as required.
-
Click Save.
This creates the new (empty) field set and opens it in the edit view.
-
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. -
Click Save.
This applies the field set configuration, making the table setup available on the Create New Invoice page.
Adding Invoice Build Button
Once set up, there are two ways to invoke the invoice creation process:
- Executing a Generic Invoice Run
- Manually using a custom button
Adding a new button for manual invoice generation involves two steps:
Completing these steps allows users to manually trigger the invoice build process from the detail page of the configured source or parent object (opportunity, order, etc.) by clicking the New Invoice button.
Creating Invoice Build Button
To create the button:
-
Navigate to the buttons list of the source or parent object.
In Salesforce Lightning, click to open the Setup menu and select Setup, then open Objects and Fields > Object Manager > Object > Buttons, Links, and Actions.
In Salesforce Classic, open Setup > Build > Customize > Object > Buttons, Links, and Actions for standard Salesforce objects. For JustOn or custom objects, open Setup > Build > Create > Objects > Object, then scroll to the Buttons, Links, and Actions section.
-
Click New Button or Link.
-
Specify the following button details.
Detail Value Label New Invoice
Display Type Detail Page Button
Behavior Display in existing window with sidebar
Content Source URL
Content /apex/ONB2__NewInvoiceFromSObject?id={!ObjectAPIName.Id}
You must replace ObjectAPIName with the API name of the object where the button is placed. -
Click Save.
For help about creating buttons, see Managing Buttons or Links.
Adding Invoice Build Button to Page
To add the button to the page layout:
-
Navigate to the page layout definition of the source or parent object.
In Salesforce Lightning, click to open the Setup menu and select Setup, then open Objects and Fields > Object Manager > Object > Page Layouts.
In Salesforce Classic, open Setup > Build > Customize > Object > Page Layouts for standard Salesforce objects. For JustOn or custom objects, open Setup > Build > Create > Objects > Object, then scroll to the Page Layouts section.
-
Click Edit in the row of the layout you intend to modify.
-
Add the New Invoice 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.
-
Click Save.
For help about modifying page layouts, see Managing Pages.
Additional Options
The generic invoice run supports a number of additional options to cover specific use cases, including:
- Configuring recurring billing
- Enabling pre-payment balance assignment
- Applying invoice criterion
- Hiding invoice line items
- Propagating associated documents
- Enabling multiple party billing
- Enabling lookup to source records
- Displaying usage data
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.
- Navigate to the fields list of the source object.
-
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
andRecurring Prorated AVG
.
If the field does not exist or is empty, it defaults to the billing typeOne-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'sservice 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 typeDate/Time
, the operatorDATEVALUE
must precede the referenced field, likeDATEVALUE(<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 typeDate/Time
, the operatorDATEVALUE
must precede the referenced field, likeDATEVALUE(<datetime_field>)
. -
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
andYear
.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) orArrears
(to be billed at the end of its service period).
Be aware that source object records withBilling Practice
set toArrears
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.
- Navigate to the fields list of the relevant object.
-
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.
- Navigate to the fields list of the relevant object.
-
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.
- Navigate to the fields list of the relevant object.
-
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 the file type is not excluded (using the field Email File Types
on the template, see Modifying Invoice Email), the linked documents are then 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.
- Navigate to the fields list of the Content Version object.
-
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:
-
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.
-
Create multiple (recipient-specific) invoice run filters as described in Creating Invoice Run Filter.
For details, see Creating Recipient-Specific Filters.
-
Optionally, configure the multiple currency billing as required.
For details, see Configuring Multiple Currency Billing.
Enabling Lookup to Sources
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.
- Navigate to the fields list of the source object ( Order).
-
Create the following new field.
API Name Data Type Description ON_<source>ID
ON_OrderIDFormula (Text) Specifies the source record ID, using the API name of the ID field Id
. -
Navigate to the fields list of the Invoice object.
-
Create the following new field.
API Name Data Type Description ON_<source>ID
ON_OrderIDLookup (<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:
-
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. -
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. -
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 toON_Invoice
on the usage data record.For help about creating flows, see Flows in the Salesforce Help.
-
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.