action.skip

Best Practice: JustOn for Salesforce CPQ

JustOn for CPQ integrates JustOn Billing & Invoice Management with Salesforce CPQ, the Configure, Price, Quote software from Salesforce.

Info

Be aware that Salesforce CPQ is not just a tool but an integral approach to cover intricate sales scenarios with complex product and pricing configurations.

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.

CPQ_integration
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:

Note

Be aware that the credit behavior differs between Salesforce CPQ and JustOn Billing & Invoice Management. CPQ uses positive prices with negative quantities for credits, whereas JustOn Billing & Invoice Management uses negative prices with positive quantities for credits.

That is, if you expect credits to be produced, you must make sure that your ON_Quantity and ON_UnitPrice fields are set up correctly. The formulas that retrieve prices and quantities from CPQ subscriptions or assets for the generic invoice run must convert the corresponding values in order to correctly handle credits (see Configuring Asset and Configuring CPQ Subscription).

Once set up as outlined, you execute the generic invoice run to create invoices from your assets and CPQ subscriptions.

JustOn Configurator package for Salesforce CPQ

The JustOn Configurator includes a configuration package to set up JustOn Billing & Invoice Management for Salesforce CPQ.

It configures the standard objects Asset and CPQ Subscription to be invoiced with JustOn. Namely, the package adds the following artifacts:

  • Invoicing fields on Asset and CPQ Subscription
  • Field set for the New Invoice page (on OrderItem)
  • Permission set for all fields
  • New Invoice buttons on Account and Contract

To complete the setup, you must, after deploying the package:

  • Assign the permission set to all JustOn users
  • Modify the formulas in ON_Quantity and ON_UnitPrice to cover the correct credit calculation
  • Modify the ON_Template formula on Asset and CPQ Subscription to include the template to be used
Asset configuration
Field Data Type Description Content
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. AccountId
ON_InvoiceBuildError Text(255) Shows errors that occurred during the last invoice run.
ON_Invoice Lookup(Invoice) The invoice that resulted from this record.
ON_IsItem Checkbox Forces JustOn to use this object as the source for both the invoice and the invoice line items. True
ON_LastInvoiceRun Lookup(InvoiceRun) Shows the last invoice run that has processed this object.
ON_Quantity Formula(Number) The quantity to be billed for this invoice line item. Quantity (standard Asset field)
ON_ServiceDate Formula(Date) The record will be invoiced when the date is null or within the service period of the invoice run. SBQQ__QuoteLine__r.SBQQ__StartDate
ON_Template Formula(Text) Specifies the Salesforce ID of the related template. ID of the template to use
ON_Title Formula(Text) The name or short description of the invoice line item. Name (standard Asset field)
ON_UnitPrice Formula(Currency) Either the net or gross price of one unit of this item. Price (standard Asset field)
CPQ Subscription configuration
Field Data Type Description Content
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. SBQQ__Account__c
ON_BillingPeriod Formula(Number) Defines the time interval (in days, months or years) after which the item is considered in the invoice run. SBQQ__QuoteLine__r.SBQQ__Quote__r.SBQQ__SubscriptionTerm__c
ON_BillingType Formula(Text) Specifies the billing behavior. Supported values for recurring items include Recurring or Recurring Prorated. If the field does not exist or is empty, it defaults to the billing type One-Time. Recurring
ON_BillingUnit 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. Month
ON_InvoiceBuildError Text(255) Shows errors that occurred during the last invoice run.
ON_Invoice Lookup(Invoice) The invoice that resulted from this record.
ON_IsItem Checkbox Forces JustOn to use this object as the source for both the invoice and the invoice line items. True
ON_LastInvoiceRun Lookup(InvoiceRun) Shows the last invoice run that has processed this object.
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.
ON_Quantity Formula(Number) The quantity to be billed for this invoice line item. SBQQ__Quantity__c
ON_ServiceDate Formula(Date) The record will be invoiced when the date is null or within the service period of the invoice run. null
ON_StartDate Formula(Date) The start date from which this item is active (may be empty). SBQQ__StartDate__c
ON_EndDate Formula(Date) The date until which this item is active (may be empty). null or
SBQQ__EndDate__c
ON_Template Formula(Text) Specifies the Salesforce ID of the related template. ID of the template to use
ON_Title Formula(Text) The name or short description of the invoice line item. SBQQ__QuoteLine__r.SBQQ__ProductName__c
ON_UnitPrice Formula(Currency) Either the net or gross price of one unit of this item. SBQQ__NetPrice__c / SBQQ__ProrateMultiplier__c
or monthly unit price
Permission Set
JustOn_CPQ_Permissions
Buttons
  • Account.New_Invoice
  • Contract.New_Invoice
Field Sets
OrderItem.GenericInvoiceRun
Filter
Name Target Parent Relationship Use Case
Asset Asset {"AccountId": "Account"} Generic
CPQ Subscription SBQQ__Subscription__c {"ON_Account__c": "Account" , "SBQQ__Contract__c": "Contract"} Generic

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:

  1. Navigate to the fields list of the source object.
  2. 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) Forces JustOn to use this object as the source for both the invoice and the invoice line items.
    The formula is true.
    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.
    JustOn always uses positive quantity values. That is, if you expect credits to be produced, the formula must convert the original value, like
    ABS(Quantity)
    ON_UnitPrice Formula (Currency) Either the net or gross price of one unit of this item.
    As opposed to CPQ, JustOn uses positive prices for invoices and negative prices for credits. That is, if you expect credits to be produced, the formula must convert the original value, like, for example
    IF(Quantity<0,Price*(-1),Price)

    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:

  1. Navigate to the fields list of the source object.
  2. 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) Forces JustOn to use this object as the source for both the invoice and the invoice line items.
    The formula is true.
    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.
    JustOn always uses positive quantity values. That is, if you expect credits to be produced, the formula must convert the original value, like
    ABS(SBQQ__Quantity__c)
    ON_UnitPrice Formula (Currency) Either the net or gross price of one unit of this item.
    As opposed to CPQ, JustOn uses positive prices for invoices and negative prices for credits. That is, if you expect credits to be produced, the formula must convert the original value, like, for example (assuming SBQQ__NetPrice__c as the original price field)
    IF(SBQQ__Quantity__c<0,SBQQ__NetPrice__c*(-1),SBQQ__NetPrice__c)
    ON_BillingType Picklist
    Formula (Text)
    Specifies the billing behavior. Supported values for recurring items include Recurring or Recurring Prorated.
    If the field does not exist or is empty, it defaults to the billing type One-Time.
    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
    ON_StartDate Date
    Formula (Date)
    The start date from which this item is active (may be empty)
    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.

  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 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: