Loading

Salesforce CPQ: Resolve "Apex CPU Time Limit Exceeded," "Heap Size Too Large," "JSON String Exceeds Heap Size Limit," and "AsyncApexExecutions Limit Exceeded" Errors During Quote Operations

Fecha de publicación: Jul 20, 2026
Descripción

This article explains how to troubleshoot and resolve Salesforce platform governor limit exceptions encountered during Salesforce CPQ operations.

The issue may occur during activities such as:

  • Quote calculation or recalculation
  • Bundle configuration or reconfiguration
  • Order creation
  • Contracting or subscription processing
  • Quote document/PDF generation
  • Large data loads or bulk quote updates

Common error messages include:

  • Apex CPU time limit exceeded
  • Apex heap size too large
  • JSON string exceeds heap size limit
  • Rate Limit Exception: AsyncApexExecutions Limit exceeded

These errors are generally caused by one or more of the following:

  • Large numbers of quote lines
  • Deeply nested product bundles
  • Complex pricing rules or calculator plugins
  • Synchronous Flow or Process Builder automation
  • Custom Apex triggers
  • Large document templates or attachments
  • Excessive Queueable, Future, or Batch Apex jobs

Solución

Cause 1: Apex CPU Time Limit Exceeded

Optimize quote calculation and reduce synchronous processing.

  1. Review any Custom Calculator Plugins for inefficient loops, repeated SOQL queries, or unnecessary processing.
  2. Configure the Large Quote Threshold to treat large quotes differently during calculation.
  3. Reduce the Quote Calculation Batch Size (for example, to 5 or 1) to decrease transaction size.
  4. Review Process Builder processes on Quote, Quote Line, Order, and Order Item objects and remove redundant automation.
  5. Review Record-Triggered Flows and move non-critical logic to Asynchronous Paths wherever possible.
  6. Optimize or temporarily bypass custom Apex triggers during large data loads using Custom Metadata or Custom Settings.
  7. Review debug logs to identify methods consuming the highest CPU time and optimize accordingly.


Cause 2: Apex Heap Size Too Large or JSON Heap Limit Exceeded

Reduce memory consumption during document generation or bundle processing.

  1. Reduce the overall size of Quote Template images and attachments.
  2. Compress images and keep individual images below approximately 200 KB where possible.
  3. Remove unnecessary attachments from Quote Templates.
  4. Simplify deeply nested product bundles by reducing bundle hierarchy levels.
  5. Limit the number of optional products within bundles.
  6. Retrieve only required fields using selective SOQL queries.
  7. Avoid storing large collections in memory; process records in smaller batches whenever possible.
  8. For integrations, paginate large API responses instead of loading entire datasets into memory.


Cause 3: AsyncApexExecutions Limit Exceeded

Reduce excessive asynchronous Apex processing.

  1. Navigate to Setup → Apex Jobs and identify which jobs are consuming the daily asynchronous limit.
  2. Determine whether Queueable, Future, or Batch Apex jobs are being repeatedly invoked from CPQ triggers or custom automation.
  3. Consolidate multiple asynchronous jobs into fewer bulk-processing Queueable jobs.
  4. During large data migrations, temporarily disable CPQ triggers using SBQQ__TriggerControl__c (Trigger Control Custom Setting), then re-enable them after the migration completes.
  5. Recalculate affected quotes after re-enabling triggers.
  6. Monitor the Apex Flex Queue and Apex Jobs to ensure asynchronous job volume remains within Salesforce limits.
Número del artículo de conocimiento

005389379

 
Cargando
Salesforce Help | Article