Enabling Usage Data Billing
Usage data represent product consumptions (volume or traffic data, service coverage, etc.) that are to be invoiced. To this end, usage data include the following information:
the date and time the consumption took place,
the quantity for the consumption, like a number of worked hours, or a number of consumed units, etc.,
an identifier, which is used to assign the usage data to a subscription item.
In broad strokes, usage data billing works as follows:
Itemizing and billing usage data
JustOn Billing & Invoice Management retrieves raw usage data (for example, via data import or a third-party integration) and usually saves it to custom objects. The continuous invoice run creates invoices and invoice line items out of these objects. It uses the transaction builder functionality to itemize the consumption data in the background, and then matches this data against the defined subscription items. Finally, it evaluates the provided quantity information and calculates the item's subtotal, producing the corresponding invoice line item.
Configuring usage data billing with JustOn
Now assume the following example:
You bill mobile phone services, and you distinguish three types of items: calls, text messages and internet data. These items are tracked separately by an external system, and are then imported. Finally, you want to distribute these items to three separate invoice line items on one invoice.
Modeling this business use case and setting up the transaction builder to itemize this usage data comprises the following major tasks:
Configuring a custom object to hold both the usage data (quantity information) and the required controlling data
Creating a subscription with three items (one for each service type)
Creating a transaction filter
Setting up the continuous invoice run
Info
For the purpose of this documentation, we assume the minimum required steps to illustrate the setup for usage data billing, where the usage data involves the quantity information only and the subscription item defines the (common) price.
Your business use case may, in addition to the quantity information, require individual prices for the consumption data. For details, see Price and Quantity Fields.
For a complete overview of the available setup options, see Controlling Usage Data Billing Options.
The section Additional Use Cases summarizes possible additional setup options for usage data billing, which may be helpful to cover your individual business use cases.
In addition, you must, of course, set up the usage data retrieval – either a data import or a third-party integration. Note, however, that this setup is not covered with this documentation, as it is too project-specific and cannot be generalized. For help with setting up the usage data retrieval, see Import Data Into Salesforce in the Salesforce Help or contact JustOn Support.
Configuring Custom Object
The transaction builder requires a number of ON fields (controlling fields and data fields) on the custom object.
Navigate to the fields list of the custom object.
Create the following new fields.
API Name | Data Type | Controlling Field | Description |
|---|---|---|---|
ON_Type | Formula (Text) | ✅ | Defines the type of the (usually transient) transaction: |
ON_OrderNo | Formula (Text) | ✅ | Represents the key to match source data to a subscription item. |
ON_Subscription | Lookup (Subscription) | ✅ | Links to the related subscription after the object records have been successfully processed. |
ON_Invoice | Lookup (Invoice) | ✅ | Links to the related invoice after the object records have been successfully billed. |
ON_LastError | Text (255) | ✅ | Displays the error message if the transaction creation has failed. |
ON_Account | Formula (Text) | ✅ | Specifies the Salesforce account ID or external ID, required if there is no or more than one account lookup on the object. |
ON_AddToTransactionTable | Checkbox | ✅ | Required when using the continuous invoice run. Determines whether to show the itemized usage data records on the invoice, deselected by default. |
ON_AddToCsv | Checkbox | ✅ | Required when using the continuous invoice run. Determines whether to export the itemized usage data records as CSV, deselected by default. |
ON_Date | Formula (Date)/ | Data field, displays the date on which the transaction is considered for invoicing. | |
ON_Quantity | Formula (Number) | Data field, specifies the quantity or volume information as accumulated for the transaction. |
For help about creating fields, see Managing Object Fields.
Info
Depending on your use case and its requirements, you can add more fields to have them filled and copied to the generated invoices or invoice line items, for example, to provide individual prices with source records. For details, see Fields on Custom Objects.
Creating Subscription and Items
As the transactions are to be matched with subscription items for the invoice generation, you must prepare a "target" subscription and corresponding items.
Create the subscription as required.
For details, see Creating Subscriptions.
Add the items to the subscription as required.
Make sure thatThe billing type is set to
TransactionalEach item's value of the
OrderNofield matches one of the possible values of the custom object'sON_OrderNofield (see Configuring Custom Object)
Your use cases may require configuring specific item data, for example, to retrieve individual prices from source records. For possible options, see Additional Use Cases.For details, see Adding Items.
→ Following the example, you create a subscription and three items – "calls", "text messages" and "internet data".
Info
Your business may require invoicing a base price, irrespective of the actually incurred usage data costs. In this case, you must enable the minimum fee calculation.
Creating Transaction Filter
To define which objects and records to include when itemizing consumption data, you create a new custom filter.
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 following filter.
Field | Required | Description | Example Value |
|---|---|---|---|
Name | ✅ | Specifies the filter name, will be available as an option picklist value when triggering the operation | |
Target | ✅ | Specifies the API name of the custom object that is to be converted to transactions |
|
Use Case | ✅ | Specifies the filter use case: |
|
Condition | Specifies a condition expression as used in an SOQL WHERE clause to restrict the set of included records. |
For help about creating filters, see Filters.
Info
Create an individual transaction filter for each custom object whose records hold usage data to be billed.
Setting Up Continuous Invoice Run
The continuous invoice run creates invoices and invoice line items directly out of objects that hold usage data. It uses the transaction builder functionality to itemize the consumption data, but does not generate "tangible" transaction records. As the name suggests, it can run multiple times, repeatedly aggregating new usage data to existing invoice line items as long as the invoice is Draft.
For the continuous invoice run to work:
Make sure that the following conditions are met:
The (custom) object that holds the usage data is set up for being processed with the transaction builder.
For details, see Configuring Custom Object.
There is a corresponding subscription and its items.
For details, see Creating Subscription and Items.
There is a corresponding transaction filter with the use case
Continuous(orContinuous Daily).For details, see Creating Transaction Filter.
Schedule a parameterized invoice run with the corresponding transaction filter (use case
Continuous/Continuous Daily) added as a parameter.For details, see Parameterized Invoice Run.
Info
For further help with setting up usage data billing in general or the transaction builder in particular, contact JustOn Support.
Additional Use Cases
The following examples illustrate additional setup options for usage data billing, which may be helpful to cover your individual business use cases.