SOLVD BLOG

How to Fix Apex Heap Size & CPU Time Limit Errors in Salesforce CPQ

Salesforce CPQ is a powerful tool for managing complex product configurations, but users may sometimes encounter intimidating Apex errors. Two of the most common are Apex heap size too large and Apex CPU time limit exceeded. Understanding the causes and solutions for these issues can prevent unnecessary frustration and keep your business processes running smoothly.

Apex Heap Size Too Large

The “Apex heap size is too large” error typically occurs when the bundle structure in Salesforce CPQ becomes overloaded. In practical terms, each time you nest bundles within bundles more than two levels deep—imagine a parent bundle, product options, and then even more nested product options—the system is tasked with loading all of that data simultaneously. This strain can quickly surpass the allowed heap size:

  • The standard heap size limit is 8.7 MB for a bundle without special configuration.
  • If your bundle’s structure exceeds this limit, you’ll see the error appear.

Solution: Enable Large Configuration

If your bundle size is just over the threshold, you can alleviate the issue by enabling Large Configuration on the product record:

  • Locate the checkbox for Large Configuration on the relevant product.
  • Enabling this converts the transaction from synchronous to asynchronous, raising the heap size limit to 12 MB.

However, this is a workaround, not a long-term solution. As you continue to add nested bundles, even this higher limit can be exceeded. Additionally, enabling this setting may slow down the quote creation process, as loading large bundles asynchronously is a more resource-intensive operation for Salesforce.

Best Practice:

  • Limit your bundle nesting to no more than two levels deep to avoid recurring errors and performance issues.

Apex CPU Time Limit Exceeded

This error is often more concerning because there isn’t a simple checkbox to fix it. The Apex CPU time limit exceeded error is almost always caused by automation overload—when too many automations are configured to run at once.

Common Causes

  • Summary Variables: These can query thousands of records every time a quote is saved, even if the rule isn’t actively used.
  • Price Rules & Product Rules (Quote Scope): Quote Scope rules execute every single time a quote is saved, which can quickly consume CPU resources.
  • Flows and Apex Classes: Improperly scoped flows or poorly optimized Apex classes can also contribute to exceeding CPU limits, though they’re usually less problematic than the earlier issues.

Troubleshooting & Best Practices

  • Review and Optimize Summary Variables: Only use summary variables when essential, and avoid querying extremely large data sets unless necessary.
  • Audit Rules: Ensure that Quote Scope rules are truly required for every save operation.
  • Update Entry Criteria for Flows: Make sure flows run only in situations where they’re needed, such as only for specific objects or under certain conditions.
  • Profile Your Apex Code: Review Apex classes to ensure efficient background processing and optimal SOQL/DML operations.

When to Get Help

Addressing these errors can require deep Salesforce CPQ expertise and careful review of your automation and bundle design. If you run into these or other Salesforce CPQ issues, don’t hesitate to reach out for experienced help.

Need expert support with Salesforce CPQ automation or error troubleshooting? Our consultants at SOLVD.cloud have a proven track record of solving these challenges for clients across industries.

yellow cloud solvd logo
Testimonials

Our clients say

From my initial call with Spencer through project implementation with John and Evan, my experience with the SOLVD team was excellent. They were quick to understand our business needs, clear when explaining the reasoning behind proposed solutions, transparent when reporting on progress and timeline, and all around enjoyable to work with. Would highly recommend and looking forward to continue working with them in the future!

Veronica Wong Director of Operations at Pathstream

SOLVD was very straight forward with everything needed to complete the project. No surprises, no issues, and cost was aligned with the estimate. They made implementation easy and quick.

Matt Benzaquen Sr Manager, Sales Strategy at Instabug

As a rule, I'm pretty stingy with my recommendations. So it's a pleasure for me to recommend Solvd as a top-flight Salesforce consultancy. Solvd recently led our company's conversion to the Lightning interface and did it on time, on budget and made it easy for me and my team. I know I'll use their services again, and am confident they can do the same for you.

Tim Tuttle CFO at Relevate Health Group

HIGHEST RATED ON SALESFORCE