Problem
Users encounter an ‘Apex heap size too large’ error when attempting to add services or promotions to a booking. The error occurs during pricing calculations and prevents the booking workflow from completing.
What We Found
The error originated in the KaptioTravel.KtApiPromo.queryPromotions class exceeding Salesforce’s synchronous heap size limit of 6MB. Investigation revealed the org had 746 active promotions, with 650 assigned to combinability groups, and 51 price categories configured on the Group Promotion service. The combination of high promotion count and complex price category configuration caused excessive memory consumption during promotion queries.
Solution
- Run this SOQL query to check active promotion count: SELECT COUNT(Id) FROM KaptioTravel__Promotion__c WHERE KaptioTravel__Active__c = true
- If count exceeds 500-700, identify promotions that apply to past sales seasons or expired date ranges
- Deactivate older promotions that are no longer needed by setting KaptioTravel__Active__c = false
- Review promotions with combinability groups - these add additional processing overhead
- Consider reducing the number of price categories on services if feasible
- Test the booking workflow after deactivating promotions to confirm resolution
Notes
- Salesforce synchronous heap size limit is 6MB - this cannot be increased
- The error stack trace will reference Class.KaptioTravel.KtApiPromo.queryPromotions when promotions are the cause
- Promotions in combinability groups consume more memory than standalone promotions
- Services with many price categories multiply the memory impact during pricing calculations
Warnings
⚠️ Do not delete promotions - deactivate them instead to preserve historical booking data ⚠️ Coordinate with the customer’s pricing/marketing team before deactivating promotions
Source: KHELP-12344