Loading
Upcoming Mandatory Changes to Public Key Infrastructure (PKI)Read More
Salesforce Enforces New Security Requirements in Summer 2026Read More
Industries Order Management
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Troubleshooting Order Management Heap Size Issues

          Troubleshooting Order Management Heap Size Issues

          When submitting an order, a System.LimitException: Apex heap size too large error indicates that a transaction has exceeded Salesforce governor limits for memory, causing the order to fail before it reaches the orchestration or fulfillment stage. In Industries Order Management, these heap spikes typically occur during the Decomposition or Orchestration Plan Composition stages as the system processes large record volumes or complex attributes. These transactions are strictly subject to a 6 MB limit for synchronous processes and a 12 MB limit for asynchronous processes.

          Order Submission Stages and Memory Impact

          During order submission, memory consumption is primarily driven by two sequential execution stages.

          Decomposition Execution

          When decomposition begins, the system performs the following actions:

          • Loads OrderItem records along with their fields and attributes.
          • Loads DecompositionRelationship__c records related to the OrderItems and collects technical products (Product2).
          • Loads ProductChildItem__c records for the technical products.
          • Processes all DecompositionRelationship__c records, including condition validation and mapping rule execution.
          • Loads InventoryItem__c records for change orders. Creates FulfilmentRequestLine__c records and associated data.

          Orchestration Plan Composition Execution

          After decomposition, the orchestration plan composition executes the following:

          • Loads the order and all associated OrderItem and FulfilmentRequestLine__c records.
          • Fetches OrchestrationScenario__c records that match the products of the Order Line Items (OLIs) and Fulfillment Request Lines (FRLs).
          • Evaluates the scenarios against defined conditions.
          • Processes OrchestrationPlanDefinition__c records from the previous step and creates OrchestrationItem__c and OrchestrationDependency__c records.

          To identify the specific cause, analyze the transaction using debug logs:

          • Enable Apex Debug logs with the following trace flags:
            • Apex Code: Info
            • Database: Info
            • All other flags: None
          • In the resulting log, review the SOQL_EXECUTE_BEGIN/SOQL_EXECUTE_END and DML_BEGIN/DML_END segments. These segments show the number of records fetched or processed for each object.

          If any of these record counts are high, for example, greater than 100, or if the cumulative total of records across multiple objects is large, it can negatively affect heap size consumption. For more details on platform limits, see Salesforce Industries CME Application Constraints.

          Potential Causes

          High heap size consumption in Industries Order Management is typically caused by processing large volumes of records or complex attribute data.

          High-Volume Records and Attributes: Processing a large number of OrderItem, FulfillmentRequestLine, OrchestrationItem, DecompositionRelationship__c, or account-scoped InventoryItem__c records increases memory usage because they contain large JSONAttribute text payloads. Additionally, picklist-type attributes on technical products consume more heap memory for metadata than text type attributes.

          Migrate Configure, Price, Quote (CPQ) and Order Management (OM) configurations to the V2 Attribute Model. If your current configurations use the V1 model, prioritize migrating to the V2 Attribute Model to reduce heap consumption.

          If either Configure, Price, Quote(CPQ) or Order Management (OM) is configured with the V1 Attribute Model, check the number of Order Item and Fulfillment Request Line records, as well as the V1 attributes configured on them, using the following example script:

          String orderId = '8013O000004z0lSQAQ';
          List<OrderItem> olis = [select Id, vlocity_cmt__JSONAttribute__c, vlocity_cmt__AttributeSelectedValues__c from OrderItem where OrderId = :orderId];
          System.debug('Order Items: '+olis.size());
          Integer totalAttrs = 0;
          for(OrderItem oli: olis) {
          if(oli.vlocity_cmt__JSONAttribute__c != null && !(String.isEmpty(oli.vlocity_cmt__JSONAttribute__c))) {
          Map<String,Object> jsonObj = (Map<String,Object>) JSON.deserializeUntyped(oli.vlocity_cmt__JSONAttribute__c);
          for(String attrCode: jsonObj.keySet()) {
          List<Object> attrMapList = (List<Object>) jsonObj.get(attrCode);
          totalAttrs += attrMapList.size();
          }
          } 
          }
          System.debug('Total OLI V1 Attributes: ' + totalAttrs);
          List<vlocity_cmt__FulfilmentRequestLine__c> frls = [select Id, Name, vlocity_cmt__JSONAttribute__c from vlocity_cmt__FulfilmentRequestLine__c where vlocity_cmt__FulfilmentRequestID__r.vlocity_cmt__OrderId__c = :orderId];
          System.debug('FRLs: '+frls.size());
          totalAttrs = 0;
          for(vlocity_cmt__FulfilmentRequestLine__c frl: frls) {
          if(frl.vlocity_cmt__JSONAttribute__c != null && !(String.isEmpty(frl.vlocity_cmt__JSONAttribute__c))) {
          Map<String,Object> jsonObj = (Map<String,Object>) JSON.deserializeUntyped(frl.vlocity_cmt__JSONAttribute__c);
          for(String attrCode: jsonObj.keySet()) {
          List<Object> attrMapList = (List<Object>) jsonObj.get(attrCode);
          totalAttrs += attrMapList.size();
          }
          }
          }
          System.debug('Total FRL V1 Attributes: ' + totalAttrs);
          

          Run the following queries to determine how much heap size the attribute data is consuming. Download the text data and save it to a file. If the file size exceeds 3 MB, it can result in heap size issues.

          select Id, vlocity_cmt__JSONAttribute__c, vlocity_cmt__AttributeSelectedValues__c from OrderItem where OrderId = :orderId
          select Id, Name, vlocity_cmt__JSONAttribute__c from vlocity_cmt__FulfilmentRequestLine__c where vlocity_cmt__FulfilmentRequestID__r.vlocity_cmt__OrderId__c = :orderId
          
          • If both Configure, Price, Quote and Order Management use the V2 attribute model, use the following setting to avoid fetching the JSONAttribute__c field entirely during order submission: From Setup, in the Quick Find box, enter Custom Settings select XOM Setup, and set AttributeModelV2Converted to true.
          • A large number of DecompositionRelationship__c records can contribute to heap size issues even when only a few Fulfillment Request Lines are created. This occurs when the majority of DecompositionRelationship__c records evaluate to false.
          • Redesign your Decomposition Relationships so that fewer of them evaluate to false; this reduces the loading of unnecessary technical products that do not result in Fulfillment Request Lines.
          • When the Order Items and Fulfillment Request Lines are within the recommended limits, check for InventoryItem__c records in the Apex debug log.

            Order Management fetches all children of account-scoped inventory items if there is a change to those items. Ensure that account-scoped technical products do not have any children to prevent the system from loading all children from different orders.

          • In some cases, many attributes in the JSONAttribute__c field contain null values that are not used during decomposition or orchestration.

            In such cases, review the Product records that contain a large number of null attributes and remove them from the design-time configuration. At runtime, these null attributes can be removed from Order Item or Fulfillment Request Line records using a custom Apex script (such as an Apex Job or Trigger); however, this must be performed carefully to avoid issues in decomposition or orchestration.

          • Check if the LoggingEnabled custom setting is set to false or deleted. This setting can be found in either of the following locations:
            • From Setup, in the Quick Find box, enter Custom Settings, select General Settings, and find LoggingEnabled.
            • From Setup, in the Quick Find box, enter Omni Interaction Configuration, and find LoggingEnabled.

          Recommended Solutions

          To resolve heap size issues and improve performance, consider these solutions.

          • Migrate to the V2 Attribute Model to reduce the volume of attribute data loaded by Order Management during runtime.
          • Separate order submission into decomposition and orchestration plan composition. This allows each process to run in its own context, increasing the available Apex heap size capacity. For more information, see Order Management Process Separation.
          • Divide large orders into multiple smaller orders. If an order contains multiple root bundles, split them into separate orders for more efficient processing.
          • Optimize product attributes by using text-type attributes instead of picklist-type attributes for technical products to save memory.
          • Remove unnecessary attributes and exclude null values during runtime to minimize the heap footprint.
           
          Loading
          Salesforce Help | Article