In this article (7 sections)
- The rule: every module follows the license count
- Modules stuck at 1 until someone clicks Recalculate
- What the pricing logs showed
- Why the first pass can't see the bundle
- The fix: read the link from the relationship when the direct link is empty
- Orders already activated don't correct themselves
- In practice
Stage: pricing the quote line, at the moment a rep adds a bundle. The client sells all-in-one offers made of user licenses and add-on modules, with one simple rule: as many modules as licenses. That rule had been automated in Revenue Cloud with code, and it only kicked in on the second calculation. I was asked to find out why.
The rule: every module follows the license count
Three licenses in the bundle, three of each module. To enforce that, the project team had plugged Apex code into pricing through a hook (an entry point Revenue Cloud provides for your own logic). The code works on the transaction context, an in-memory picture of the quote and its lines. For each line it read the product, the quantity and the parent line, meaning the bundle it belongs to, then set the module quantities to match the licenses.
Modules stuck at 1 until someone clicks Recalculate
The rep adds the bundle, enters 3 licenses, saves. The modules stay at 1. If they click Recalculate, the modules jump to 3.

Nobody thinks to recalculate a quote they just saved, so quotes were going out to customers with the wrong quantities.
What the pricing logs showed
The pricing logs on the customer's quote showed the code running twice. On the first run it found no license lines. On the second it found everything. To see what was missing, the team reproduced the case in a sandbox, adding the bundle in code exactly the way the UI does, with a temporary debug line that printed the context on the first pass.
Why the first pass can't see the bundle
On the first save of a new quote, the bundle's lines don't exist in the database yet. Revenue Cloud prices them before it writes them. So the "this line belongs to that bundle" link, which normally points to the parent line's ID, is empty in the context: there's no ID to put there yet. The link does exist, just somewhere else, on the record that describes the relationship between the bundle and its component, as a temporary reference.
On the second pass the lines have been saved, the direct link is filled in, and the code finds what it's looking for. That's also why the bug gets through testing: as long as you test by editing an existing quote, every line already has an ID and the rule works. The code wasn't wrong. It assumed the context looked the same on every pass.
The fix: read the link from the relationship when the direct link is empty
The code now reads the relationship's temporary reference whenever the parent-line link is empty. That reference has a different format depending on how the bundle was added (in code, through the configurator, or from the quote screen), and the fix handles all three. Validated in the sandbox and then in production, it gives the modules the right quantity as soon as the bundle is added, before the quote is even saved.
Orders already activated don't correct themselves
The client's next question was about orders already in flight. Once an order is activated, Revenue Cloud locks pricing. You can fix the quantity shown on the order, but the customer's assets and the billing schedules can't be changed after the fact. To realign everything you need an amendment, or you wait for the renewal, which goes through the corrected pricing.
In practice
- Test every bundle rule on a brand-new quote, on its very first save, not just by editing an existing quote.
- Read the pricing logs before touching the code or the pricing procedure: they show how many times the code runs and what it sees each time.
- Run one test per way of adding the bundle: in code, through the configurator, from the quote screen.
- Before promising a retroactive fix, list the affected activated orders and plan an amendment or the renewal for each one.