CPQ – Amendment Discount Amount – Fix

The Issue
We recently discovered an issue with amending a Contract containing lines that had a Discount Amount on the original Quote. The issue is that, when you amend a line that has a Discount Amount from the original Quote, the whole discount value is put on that line from before. Which doesn’t make sense because when it is an amount, it should be a prorated amount based on the time left on the Contract. Because of this, when a customer cancels a Contract, the refund amount (negative amount) on the Quote would be different than what was actually owed.

Another Detail
A Quote Line that had a Discount % applied turns into a Subscription with the Discount % filled in. All good. When it renews, the renewal Quote Line has Discount AMOUNT $ filled in?! Not a Discount %. So as your discounted customers renew, this issue is propagated.

But but but, what about the ProrateAmountDiscounts__c special field as referenced here? This is a great solution but this will apply the proration to all types of Quotes. We only want it to apply to amendments.

The Solution
So I made a thing! It is two formula fields and a Price Rule. This thing will prorate the discount for any lines that had a Discount Amount on the original Quote.

Subscription – Original Discount $

Quote Line – Original Discount $

Price Rule – Quote Line – Amendment – Inject Calculated Discount $

Pertinent Price Rule Details

Calculator Evaluation Event: Before Calculate

Price Conditions

Quote . SBQQ__Type__c equals Value Amendment
Quote Line . NOT(ISBLANK(Original_Discount_Amt__c)) equals Formula True

Price Actions

Quote Line . Discount (Amt) = Original_Discount_Amt__c / (IF(SBQQ__DefaultSubscriptionTerm__c == 1, SBQQ__EffectiveSubscriptionTerm__c, 1) / SBQQ__ProrateMultiplier__c)

And here is the production install link and this one for sandbox!

After you install, be sure to run the below script in the execute anonymous popup in the developer console. Click here to open the developer console in production and here to open it in sandbox.



2 thoughts on “CPQ – Amendment Discount Amount – Fix

  1. Thank you! Great idea! This has helped me resolve major issue.
    However, for quotes with subscription term not 12, do we need to change the price rule formula OR use effective subscription term in any case?

    subscOriginal_Discount_Amt__c / (IF(SBQQ__DefaultSubscriptionTerm__c==1,SBQQ__EffectiveSubscriptionTerm__c,1)/SBQQ__ProrateMultiplier__c)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.