Problem
When using SFI (Salesforce Import) to bulk import items to Itinerary Items, the import fails with an ‘Apex heap size too large’ error. This typically occurs when importing a large number of items that span multiple itineraries.
What We Found
The error occurs because the default batch size causes the system to load too many itineraries and items simultaneously into memory. For example, importing 113 items related to 65 different itineraries will load all 65 itineraries plus 113 items at once, exceeding Salesforce’s synchronous heap size limit of 6MB. This is different from a Row Lock error - heap size errors occur when the system tries to use more memory than available, while row lock errors occur when the system gets stuck trying to process something.
Solution
- Open the SFI import interface
- Locate the batch size setting (chunk size option)
- Reduce the batch size from the default to a smaller number such as 20
- For very large imports with complex data, consider setting batch size to 1 to process one item at a time
- Re-run the import with the reduced batch size
- The import will be slower but will complete successfully without hitting memory limits
Notes
- Smaller batch sizes will result in slower imports but avoid memory errors
- The optimal batch size depends on the complexity of your data and how many itineraries are affected
- Processing one item at a time is still faster than manual entry
- This setting allows customers to define the chunk size that best suits their needs as it is rarely a ‘one size fits all’ scenario
Warnings
⚠️ Salesforce has a 6MB heap size limit for synchronous transactions ⚠️ Imports spanning many itineraries require smaller batch sizes due to loading all related itinerary data
Source: KHELP-12291