Loading
Get Started with Communications, Media, and Energy & Utilities (CME)...
Apply CPQ Mass Discount on Large Carts

Apply CPQ Mass Discount on Large Carts

Industries CPQ splits root line items into smaller background chunks when processing mass discounts on large Quote and Order carts, so sales reps can apply discounts to enterprise carts with tens of thousands of line items.

Required Editions

Available in: Classic and Lightning Experience
Available in: Enterprise, Unlimited, and Developer Editions for CME Managed Package

Before You Begin

Redeploy the updated flexcard components to see the latest changes in the UI. If you don't redeploy, the existing implementation continues to work as before and points to the previous behavior.

Redeploy these existing components:

  • cpqCartAppliedDiscount
  • cpqApplyDiscountInfoModal
  • cpqCreateCustomDiscountModal
  • cpqDiscountList
  • cpqCartDiscount

Deploy these new components:

  • cpqMassDiscountContainer (Flexcard)
  • cpqMassDiscountEventLoader (LWC)
  • CPQ_StartMassDiscountExpanded (IP)

How Mass Discounting Works

The mass discount feature applies a single discount across all root line items in a Quote, Order, or Opportunity cart. Root line items are top-level products in the cart. Bundle components and child items receive the discount through the parent product, not directly.

When a sales rep triggers a mass discount from the cart UI, Industries CPQ runs the operation asynchronously in the background. The cart stays open and usable while the job runs, and the rep sees a status update when the operation completes. Mass discounting works the same way on Quote, Order, and Opportunity carts. Quote and Opportunity carts use a different internal pagination method due to platform constraints, but this has no effect on feature behavior.

The updated implementation stores a small set of pagination cursors called bookmarks instead of item IDs. For a cart with 50,000 root items, the cursor list stays well within the 131,070-character platform limit. Industries CPQ stores bookmarks temporarily in CachedAPIResponse__c, an existing platform object that requires no schema changes, and deletes them automatically after processing completes.

Three-Step Processing Model

Mass discount processing runs in three asynchronous steps.

Create Bookmarks

The system queries root line items in pages of up to 5,000, stores the ID of the last item in each page as a bookmark in CachedAPIResponse__c, and returns a list of bookmark indices to the async engine. For a cart with 50,000 root items, this creates approximately 10–30 bookmarks, with 20 as the default. Industries CPQ registers the discount at the cart level before processing any items.

Apply Discount

The system reads each bookmark, queries up to 5,000 root items that follow as a chunk, and sends those items to the pricing service in batches of 5. Chunks run serially, one batch at a time, which reduces overall wall-clock time.

Note
Note Actual times vary based on pricing service response time and platform load. The pricing API response time directly affects per-chunk duration. The chunk size is fixed at 5,000 root items per async execution. Processing time scales with cart size.

Cleanup

A cleanup step runs at the end of processing to delete all bookmark records for the cart.

Considerations

  • When you enable the Fail Fast flag, batch processing stops immediately on the first failure instead of waiting for all batches to complete.
  • The IsRetry flag re-executes the last failed job without registering the discount again, so no new discount is added. Click the Reapply button to set this flag automatically.
  • A new DiscountStatus field on Quote, Order, and Opportunity objects reflects the current state of the applied discount.
  • The Reapply button is visible in the UI only when the last job on a cart has a failed status.
  • When a retry succeeds, the system automatically resolves the previous failure and applies all discounts successfully. The system skips line items that were successfully processed in earlier attempts and does not re-apply discounts to them.
  • The applied discount API does not return the DiscountCode field, which prevents the UI from displaying it.
  • The implementation uses serial processing for Quote, Order, and Opportunity carts.
 
Loading
Salesforce Help | Article