A Salesforce CPQ org has no page that says how a price is calculated. If a quote line came out at $73.42, the accurate explanation is a list: these rules fired, in this order, and that number is what was left in the field when they stopped.
Nobody wrote that list down. Each price rule is a record with its own conditions and actions, an evaluation event (on initialization, or before, on or after calculate) and an evaluation order number. The pricing logic of the org is the sum of those records sorted by two fields. You can read any one rule in a minute. You can’t read the price anywhere.
Pricing procedures in Revenue Cloud Advanced take the opposite position. A procedure is one artifact that lists its steps in sequence, and each step names what it reads and what it writes. When it runs it can keep a price waterfall, a per-step record of how the number moved. I think that’s the single biggest change in the new engine, bigger than anything about performance or APIs, and it has a cost people find late: you have to state the order you were getting by accident.
One line, traced through the old engine
The example below is invented so I can show real arithmetic. Hollowell Electric is a made-up distributor quoting 500 reels of building wire to a customer that holds a pricing contract, during a spring promotion.
To build the trace I’d take that one line, check every active rule’s conditions against it, and record each rule that fired along with the field it wrote. Fourteen rules fire, across three evaluation events. The right-hand column is where each one lands in the rewrite.
| # | Event, order | Old rule | Field it changed | Procedure step |
|---|---|---|---|---|
| 1 | Before, 10 | Stamp sales region | Region (custom) | Input |
| 2 | Before, 20 | Flag contract account | Has Contract (custom) | Input |
| 3 | Before, 30 | Copper index surcharge | List Unit Price | 1. List price |
| 4 | Before, 40 | Reel size uplift | List Unit Price | 1. List price |
| 5 | On, 10 | Find volume tier | Volume Tier (custom) | 2. Volume tier |
| 6 | On, 20 | Apply volume tier | Special Price | 2. Volume tier |
| 7 | On, 30 | Set special price type | Special Price Type | 2. Volume tier |
| 8 | On, 50 | Contract discount | Additional Disc. (%) | 3. Contract discount |
| 9 | On, 50 | Spring promotion | Additional Disc. (%) | 4. Promotion |
| 10 | On, 60 | Clear expired promo code | Promo Code (custom) | 4. Promotion |
| 11 | On, 70 | Set freight class | Freight Class (custom) | Input |
| 12 | After, 10 | Compute margin | Margin % (custom) | 5. Margin floor |
| 13 | After, 20 | Flag margin floor | Below Floor (custom) | 5. Margin floor |
| 14 | After, 30 | Write approval reason | Approval Reason (custom) | Not pricing, moved out |
Rows 8 and 9 are the whole story. Both write the same discount field, and both carry evaluation order 50. The contract rule sets 12 percent. The promotion rule sets 5 percent. Whichever fires second owns the field.
At Hollowell the promotion had always fired second. The admins believed ties followed the order the rules were activated in, and they’d treated that as a law for years: never deactivate and reactivate the contract rule, because prices would change. I wouldn’t rely on that, and I’m not aware of any documented guarantee about ties. But it explains the folklore. The most important pricing decision in the org, what happens when a contract customer buys during a promotion, was stored as the activation history of two records.
The line’s arithmetic goes like this. List price lands at $84.00 a reel after rows 3 and 4. The 250 to 999 tier takes 8 percent off, so $77.28. Then the surviving 5 percent brings it to $73.42. The customer’s 12 percent contract discount never touches the price.
The same line as five declared steps
Before building anything in the procedure builder, I’d write the procedure as a plain file. This one is YAML because it diffs well in review. It’s a design document, and nothing imports it.
procedure: cable-line-pricing
version: 1
runs_on: quote_line
inputs:
- product
- quantity
- region
- copper_index
- account_contract_id # empty when the account has no contract
- promo_code # empty or expired means no promotion
- unit_cost
steps:
- order: 1
name: list_price
reads: [product, region, copper_index]
writes: [list_unit_price]
logic: price book entry, plus copper surcharge, plus reel size uplift
replaces_rules: [3, 4]
- order: 2
name: volume_tier
reads: [quantity, list_unit_price]
writes: [tier_price]
logic: look up percent off by quantity band and apply to list_unit_price
replaces_rules: [5, 6, 7]
- order: 3
name: contract_discount
reads: [account_contract_id, tier_price]
writes: [contract_price]
logic: apply contract percent to tier_price; equals tier_price if no contract
replaces_rules: [8]
- order: 4
name: promotion
reads: [promo_code, tier_price, contract_price]
writes: [customer_price]
logic: apply promo percent to tier_price; keep the lower of that and contract_price
replaces_rules: [9, 10]
- order: 5
name: margin_floor
reads: [customer_price, unit_cost]
writes: [net_unit_price, below_floor]
logic: copy customer_price to net_unit_price; set below_floor, never change the price
replaces_rules: [12, 13]
moved_out:
- rule: 14
to: approval process
open_decisions:
- step: 4
question: when contract and promotion both apply, which one wins
old_behavior: promotion, because it fired last
declared_here: the lower price
The template has two rules of its own. Every step’s reads must be either an input or something an earlier step wrote. And no two steps may write the same output. That second rule is what catches rows 8 and 9, because the moment you try to give both steps the old discount field, the file is invalid and you have to invent contract_price and customer_price and say how they relate.
That’s step 4, and writing its logic line is the first time anyone at Hollowell would be asked the question out loud. I declared “the lower price” on purpose, to see what it does to history.
196 of 200, and the four are the interesting ones
Replay 200 historical quote lines through both engines and compare net unit price to the cent. In this example 196 match. The four that differ are exactly the lines where rules 8 and 9 both fired, and the 500-reel line is one of them: $68.01 from the procedure against $73.42 from the rules, a difference of $2,705 on the order.
A parity test that passes at 100 percent would have told me less. Those four lines are a list of customers who were promised 12 percent and got 5, or a promotion that was always meant to replace contract pricing, and only the business knows which. If it’s the second, I change one line in step 4 to “promotion wins” and the replay goes to 200 of 200, this time because somebody chose it.
Rewriting isn’t free. Fourteen small records became five steps that someone has to own as a unit, and a change to step 2 now needs the whole procedure retested. The earlier inventory post tags chained rules as “changes shape” for this reason.
I’d still do the trace table before any migration date gets set, and I’d do it even if the migration never happens. An org that plans to stay on CPQ for years can still have its own rows 8 and 9.