Salesforce CPQ – Pricing Logic Review


This is a quick follow-up post to ‘CPQ Pricing Logic Quickview‘ from a while back. I received a few requests to make the demonstrated component available on GitHub, and was terribly lazy in performing the bit of cleanup necessary to make that happen. I’ve found the tool to be very helpful in finding issues in the Pricing Waterfall that otherwise would require a lot of clicking through records, and hope it saves you some time as well.

GitHub Repo

Without further ado, here is the repo for the component PricingLogicReview.

Important: This is a very rudimentary tool for CPQ administrators and support teams. As such, there wasn’t much time spent outside of the basic functionality. An additional note is that I wasn’t able to foresee any reuse out of the logic, so stuffed everything in the controller for the sake of simplicity – tsk, tsk. As a very mediocre self-taught ‘developer’, I’m sure the pros out there will find many improvements to make or mistakes to correct!

Create the 2x Apex Classes (don’t forget to add the controller to whatever permission set(s) you use for AuraEnabled classes), LWC, and Custom Label pointing to your QCP….find a home for the component, and play away. There are some pre-conditions as you’ll notice, and please adjust as needed to fit your org.

Price Waterfall Sequence Reminder

Quick reminder on the order of evaluation.

1System – Twin Field Fill
2Price Rule – On Initialization
3QCP – onInit
4System – Formulas (Q, QL, QLG)
5Price Rule – Before Calculate
6QCP – onBeforeCalculate
7System – Line Qty. Updates
8QCP – onBeforePriceRules
9Price Rule – On Calculate
10QCP – onAfterPriceRules
11System – Target Amount
12System – Totals Reset
13System – Totals Recalculation
14System – Discount
15Price Rule – After Calculate
16QCP – onAfterCalculate
17System – Formulas (QL, QLG, Q)
18System – Totals Calculation
19System – MDQ Summary

Thanks for reading!

One comment

Leave a Reply

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