Adaptal

CPQ Quote Apex Error (Heap Size Too Large)

Best Practice

CPQ Logo

Overview

Salesforce CPQ (Configure, Price, Quote) is a powerful tool designed to streamline the sales process by enabling organisations to quickly generate accurate quotes for their products and services. With its intuitive interface, sales teams can easily configure complex product offerings, apply pricing rules, and generate professional quotes, all within a unified platform. This automation not only saves time but also minimises errors, ensuring that sales representatives can focus on closing deals rather than getting bogged down in administrative tasks.

As a Salesforce Consulting Partner, we are thrilled to help our clients tailor the quoting system they require and maximise the possibility with the adoption of Salesforce CPQ. However, some clients have experienced an Apex Heap Size Too Large error when they tried to save / reconfigure a CPQ Quote. This article outlines the error, the potential causes (in particular Bundle Looping) as well as the solutions.

Apex Error

When clients try to save/ reconfigure a CPQ Quote, especially one with a lot of line items, they may encounter an “Apex Heap Size Too Large” error. 

Salesforce enforces an Apex Heap Size Limit of 6MB for synchronous transactions and 12MB for asynchronous transactions. The “Apex heap size too large” error occurs when too much data is being stored in memory during processing.

 

Potentail Causes

  1. Large Number of Product Options: a bundle (product with product options) that has few hundred or more product options can potentially cause the error. However, there is no set benchmark / limits of how many options can be configured as the Apex heap size is collectively impacted by a number of factors (number of options, nested bundle, price and product rules, validations etc.).
  2. Bundle Looping: When a product option points back to the parent product (Configured SKU = Optional SKU), it will cause an infinite loop that throws the error. See screenshot of an example below: the Configured SKU and Optional SKU is both S2. This will likely lead to error occurring as long as S2 is chosen even if this specific product option is not selected in the quote configuration. 
BAAAAAElFTkSuQmCC
 
Solutions
  1. Tick the “Enable Large Configuration” checkbox in the managed package settings. This increases heap sizes up to 12 MB.
  2. Delete/ reconfigure the product option that causes the bundle looping. To identify if a product has looping components, users can create a product option report that compares the Configured and Optional SKU fields. In the example below, a row-level formula column was created in a production option report to return “Loop” of Configured SKU and Optional SKU are the same.
 
wMZyya7Bg2aeQAAAABJRU5ErkJggg==
 

 

       3. Try to avoid adding too many product options to a product if possible.

Conclusion

We hope this article helps you resolve the issue should you encounter the error. We believe that by leveraging Salesforce CPQ, businesses can enhance their sales efficiency and improve customer satisfaction. The solution integrates seamlessly with other Salesforce applications, providing a holistic view of customer interactions and sales data. With features like guided selling, pricing optimisation, and real-time analytics, organisations can respond more effectively to customer needs and market demands. Ultimately, Salesforce CPQ empowers sales teams to deliver tailored solutions quickly, fostering stronger relationships and driving revenue growth.

Should you have any issues with the implementation of Salesforce CPQ / other enquiries, feel free to contact us for further help.