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 (aka metered billing, usage-based billing or pay-per-use) works as follows:
JustOn retrieves raw usage data (for example, via data import or a third-party integration) and usually saves it to custom objects. The transaction builder converts this data to transactions. During the invoice run, JustOn matches the transactions against the defined subscription items, evaluates the provided quantity information and calculates the item's subtotal. This data then makes up the according invoice line item.
Itemizing usage data with the transaction builder
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.
You can still set up JustOn to actually create transactions and transaction details, see Transaction Builder Setup Options.
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 and the controlling data
- Creating a subscription with three items (one for each service type)
- Creating a transaction filter
- Setting up the continuous invoice run
For the purpose of this documentation, we assume the minimum required steps to illustrate the setup for usage data billing and the transaction builder, including the continuous invoice run. For a complete overview of the available setup options, see Transaction Builder Setup Options.
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.
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 created transaction, either
When using the continuous invoice run, set
Transactionas the value.
ON_OrderNo Formula (Text)
Represents the key to match source data to a subscription item.
If you use a lookup relation or a formula to determine the order no, make sure that your logic produces the same order no value for both the source object and the item.
If you get individual records for different types of usage data, you need a formula that yields the intended target item.
If you get different usage data types in one record, you specify a comma-separated list of target items.
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.
The formula uses the API name of the field that links the object to the account, for example,
ON_AddToTransactionTable Checkbox Required when using the continuous invoice run. Determines whether to show the transaction on the invoice, deselected by default. ON_AddToCsv Checkbox Required when using the continuous invoice run. Determines whether to export the transaction 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.
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 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 that
- The billing type is set to
- Each item's value of the
OrderNofield matches one of the possible values of the custom object's
ON_OrderNofield (see Configuring Custom Object)
For details, see Adding Items.
Following the example, you create a subscription and three items - "calls", "text messages" and "internet data".
- The billing type is set to
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 in the transaction build process, you create a new custom filter.
In Setup, 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 for the transaction build.
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) target object that is to be converted to transactions
Use Case Specifies the filter use case, either
When using the continuous invoice run, set
Continuousas the value.
With large data sets, you can ask Salesforce to have the field
ON_Date__cindexed, and then use
Continuous Dailyfor the continuous invoice run. For details, see here.
Condition Specifies a condition (SOQL WHERE clause) to restrict the set of included records.
For details, see SOQL SELECT Syntax in the Salesforce Help.
Note that objects on which
ON_Invoiceis already filled will be ignored.
For help about creating filters, see Filters.
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
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
For details, see Creating Transaction Filter.
Schedule a parameterized invoice run with the corresponding transaction filter (use case
Continuous Daily) added as a parameter.
For details, see Parameterized Invoice Run.
For further help with setting up usage data billing in general or the transaction builder in particular, contact JustOn Support.
Return to JustOn Administration.