Best Practice: JustOn for Salesforce CPQ
JustOn for CPQ integrates JustOn Billing & Invoice Management with Salesforce CPQ, the Configure, Price, Quote software from Salesforce.
Salesforce CPQ uses assets for one-time products. For recurring items, it produces contracts and CPQ subscriptions.
To allow for automatic billing, the assets as well as the CPQ subscriptions are configured to hold the required invoicing data. Consequently, JustOn for CPQ employs the generic invoice run to generate invoices from both the assets and the CPQ subscriptions.
Solution Outline
In broad strokes, the solution works as follows:
(1) Salesforce CPQ and JustOn are installed in your org.
(2) From your quotes with quote lines, you create orders with order items.
(3) For one-time products, Salesforce CPQ creates assets based on the corresponding order items. On top of the assets, you set up the generic invoice run.
(4) For recurring items, Salesforce CPQ creates contracts and CPQ subscriptions out of the corresponding orders and order items. Based on the CPQ subscriptions, you set up the generic invoice run for recurring items.
(5) With your accordingly set up CPQ solution, a new or modified quote generates a new order item, which then produces either a new asset or a new CPQ subscription – depending on the type of product involved.
(6) Using the generic invoice run, JustOn will directly produce invoice line items from the new assets or new CPQ subscription.
Integrating JustOn's advanced billing with Salesforce CPQ
Integrating the JustOn's generic invoice run with Salesforce CPQ involves at least the following configuration tasks:
- Adding custom fields to the Asset object to control the invoice creation
- Adding custom fields to the CPQ Subscription object to control the invoice creation for recurring items
- Creating corresponding generic invoice run filters
Once set up as outlined, you execute the generic invoice run to create invoices from your assets and CPQ subscriptions.
Configuring Asset
The asset will be the single source object for both the invoice and the (one-time) invoice line items, as described in Single Objects. The invoicing process requires a number of ON fields on the asset:
- 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. 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) Forces JustOn to use this object as the source for both the invoice and the invoice line items.
The formula istrue
.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. For more information, see Setting Up Single Object.
Configuring CPQ Subscription
The CPQ subscription will be the single source object for both the invoice and the (recurring) invoice line items, as described in Single Objects. As with assets, the invoicing process requires a number of ON fields on the CPQ subscription. To cover the recurring use case, however, you need additional fields that hold the specific recurring billing information:
- 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. 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) Forces JustOn to use this object as the source for both the invoice and the invoice line items.
The formula istrue
.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. Billing Type ON_BillingType Picklist
Formula (Text)Specifies the billing behavior. Supported values for recurring items include Recurring
orRecurring Prorated
.
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) End Date ON_EndDate Date
Formula (Date)The date until which this item is active (may be empty) For more information, see Setting Up Single Object and Configuring Recurring Billing.
Info
You can set up JustOn to allow for starting the generic invoice run from a parent of the actual source object. Following the outlined solution, you can configure the Contract object to allow for invoicing all CPQ subscriptions that belong to a given contract. For details, see Enabling Invoice Run From Parent.
Creating Generic Invoice Run Filters
To define which records to include in the invoice run, you create custom filters.
-
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 filters.
Name Target Use Case CPQSubscriptions SBQQ__Subscription__c Generic Assets Asset Generic For additional information, see Creating Invoice Run Filter. For help about creating filters, see Filters.
Executing Invoice Run
Once set up, there are multiple ways to invoke the invoice creation process:
- Manual execution from the Invoice Runs tab, as described in Executing a Generic Invoice Run
- Manual execution from the Asset or CPQ Subscription (optionally, Contract) detail page, following the setup described in Adding Invoice Build Button
- Automatic execution on a regular basis, as described in Scheduling Invoice Run