You are here:
CPQ Quote Calculation Stages
When an action causes a calculation, the Salesforce CPQ Advanced Quote Calculator runs through a series of steps to determine pricing for quote lines and quote. (Salesforce CPQ Managed Package)
Required Editions
| Available in: Salesforce CPQ Spring ’16 and later. |
When you perform an action that starts a calculation, the Salesforce CPQ advanced quote calculator performs these actions.
Important If a user or process changes a product during calculation, data from the
new product is not available until a new calculation begins.
Loading and Initialization
- Loads products and options
- Loads lookup relationships
- Retrieves formula field metadata
- Executes price rules where the value in the Event field is On Initialization
- Initializes plugins, if you have any
- If the plugin was initialized, execute the plugin’s onInit() method
- Updates related records in case the plugin or price rules sent new IDs
First Round of Calculations
- Calculates formula fields on the quote lines
- Calculates formula fields on the quote
- Calculates formula fields on the quote line group
- Executes price rules where the value in the Event field is Before Calculate
- If you’re using a plugin, execute the plugin’s onBeforeCalculate() method
- Updates related records in case the plugin or price rules sent new IDs
Second Round of Calculations
- Calculates line quantities
- If you’re using a plugin, execute the plugin’s onBeforePriceRules() method
- Executes price rules where the value in the Event field is On Calculate
- If you’re using a plugin, execute the plugin’s onAfterPriceRules() method
- Updates related records in case the plugin or price rules sent new IDs
- Ensures that any discount schedules injected by price rules have loaded properly
- Indexes line item quantities according to schedule and group keys
- If the quote contains a target amount, reset the quote’s discounts
- Resets quote and group totals
Third Round of Calculations
- Calculates fixed items
- Calculates dynamic items
- Calculates totals
- If the quote contains a target amount, apply discounts proportionally across the quote so that the quote reaches the target
- Combines identical bundle components into one quote line
- Executes price rules where the value in the Event field is After Calculate
- If you’re using a plugin, execute the plugin’s onAfterCalculate() method
- Updates related records in case the plugin or price rules sent new IDs
Final Evaluations and Updates
- Evaluates quote line formula fields again
- Evaluates quote line group formula fields again
- Evaluates quote formula fields
- Calculates totals for groups and the quote again, since line-level totals may have changed
- Summarizes MDQ segments and related fields
- Deletes plugin modules, if any
- Updates related records in case the plugin or price rules sent new IDs
To detect upserts of Quote Lines that will later be rolled back, you can examine SBQQ__Incomplete__c field, which is set to TRUE during the rolled-back transaction.
Important
- Salesforce CPQ prevents users from chaining multiple calculations within one transaction. This limit ensures that Salesforce CPQ stays within the Salesforce platform governance limits. Salesforce CPQ sets a flag the first time that CPQ triggers run for calculations that prevent the trigger from firing again. As a result, workflow rule and process builder updates to a calculating field don’t cause a second calculation.
- Block price products populate List Price on the “Calculates fixed items” calculation stage.
- To avoid issues with JavaScript’s floating point arithmetic, equality-based formulas on quotes and quotes lines must use ROUND() on Currency values.
Did this article solve your issue?
Let us know so we can improve!

