CPQ Ninja: Disable subscription proration calculations for specific products

Configuring products in Salesforce CPQ is one of the most challenging tasks in the platform. It is extremely important to set up your pricing model correctly to allow your organization to use CPQ to its full potential without a lot of customizations. In this document I will cover a very common pricing scenario where it is necessary to disable the proration factor of CPQ renewable products to allow for fine grain control of a fixed price over the term of a contract.

Renewal products in CPQ are pretty straightforward, you normally have a few settings to play with:

  • Subscription Type: Defines if your product will be considered a subscription. Options are one-time and renewable.
  • Subscription Pricing: Defines how to calculate the price of the subscription. Percent of Total allows CPQ to calculate the price of this product based on other products in the quote. Fixed price will use the price in the price book.
  • Subscription Term: The base number of months or days represented by the price book price.

In most situations the options above will cover common scenarios, however, in some industries it is necessary to sell renewable products that have a fixed price independent of the duration of the contract. A perfect example is when dealing with account credits. In this scenario, customers should be able to buy credits at a fixed price of $300. These credits can be used anytime during the term of the contract and should be renewable. Consider the following product:

Product: Credits
Subscription Type: Renewable
Subscription Pricing: Fixed
Subscription Term: 12
Price in Pricebook: 300 USD

In the product configuration above, adding the product to the quote line editor with a term of 24 months will double the price to 600 USD per standard configuration:

To avoid this behavior and make the fixed price independent of the term, we will need to disable proration following the instructions in this guide.

Please note that there is no comprehensive official documentation on the Calculator plugin field “calculateFullTermPrice” used in this example. Proceed with caution keeping in mind that CPQ might stop supporting this approach without notice.
Credit for the approach goes to Josh Rivera for first mentioning this idea in the Idea Exchange here.

Create a field on the Product object to disable proration

To keep our approach as maintainable as possible, create a field in the product object to control this behavior. This should be a custom field of type checkbox and will allow your team to control which products will ignore proration. In this example we will use the following template:

Field Label: Disable Proration
Field API name: DisableProration__c
Type: Checkbox

Creating a field will allow you to check and uncheck this field to control the proration behavior without changing your code.

Leverage the Quote Calculator Plugin to disable proration

The quote calculator plugin (QCP) is a powerful CPQ tool that allows you to perform specialized customizations of the CPQ platform. The QCP leverages the out of the box CPQ framework within the calculation lifecycle for efficiency and scalability purposes. You can explore more about the QCP here, for our purpose we will use only basic customization functionality.

1. Navigate to the “Custom Scripts” Object. This object comes natively with CPQ and can be used to store QCP scripts.

2. Create a record in Custom Scripts and select a name. In this example we will use “ScriptDisableProration”

3. In the Code field use the following script as a baseline and customize it to your needs:

export function onInit(quoteLineModels) {
    if (!quoteLineModels) {
        return Promise.resolve();
    }
    for (var i = 0; i < quoteLineModels.length; i++) {
        if (quoteLineModels[i].record["SBQQ__Product__r"]["DisableProration__c"]) {
            quoteLineModels[i].calculateFullTermPrice = true;
        }
    }
    return Promise.resolve();
};

The above script will fire on initialization of the calculation sequence and iterate through all the quote lines. If the quote line product has the checkbox we created checked, then the calculateFullTermPrice property will be activated to indicate CPQ to ignore the out of the box proration logic.

Your script should look something like this:

4. To enable your script to run, navigate to the Installed Packages configuration under Setup > Installed Packages > Salesforce CPQ Configuration

5. In the Plugins tab, enter the Record Name created in step 2

Now go to your quote line editor and test by changing the term on your quote line. Notice that the price will not change when the term is updated.

About me

Article by Stefan Zepeda
Hands-on Technical Architect and Salesforce enthusiast with experience collecting requirements, transforming them into solutions and implementing them efficiently on any tehcnology platform.

3 thoughts on “CPQ Ninja: Disable subscription proration calculations for specific products

    • Hi Riley, I haven’t tested this with MDQ. Did you end up creating a new field for this? I have seen some users have issues if the field is not used in another price rule. To test you can modify the plugin to check for a sku number to test

      Like

      • I created a new field for DisableProation on the Product level. Do I need to create the same field on the quote line level?

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s