Revenue Cloud project notebook, written by two Meir IT consultants who implement it.

What is Revenue Cloud?

Pricing·Admin

Revenue Cloud Bundle Quantities Wrong on the First Save

Bundle modules were supposed to follow the license count and only did on the second calculation: on the first save, the link to the bundle isn't where the code was looking.

Nathan Altmann · Revenue Cloud consultant at Meir IT

Published 4 min read

Admin path·5 of 12·Next: Generating the Quote Document from the Pricing Context

In 3 linesfor leadership

  1. Quotes went out to customers with the wrong module quantities in bundled offers.
  2. The pricing code looked for the bundle link where it doesn't exist yet, on a new quote's first save.
  3. Fixed in production; orders already activated can only be realigned by an amendment or at renewal.
In this article (7 sections)
  1. The rule: every module follows the license count
  2. Modules stuck at 1 until someone clicks Recalculate
  3. What the pricing logs showed
  4. Why the first pass can't see the bundle
  5. The fix: read the link from the relationship when the direct link is empty
  6. Orders already activated don't correct themselves
  7. 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.

Quote line editor: click on Reprice All, recalculation banner, then confirmation message.Enlarge
“Reprice All” recalculates every quote line and revalidates the bundle configuration.

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.
A technical question about this article?

A question about this article? I reply within 48 hours.

Something unclear, a mistake, or different behavior in your Salesforce org? Write to me.

Prefer email? Write to nathan@meir-it.com

Get notified of new articles

Type at least two letters.