Issue
Users attempting to create a new Box Doc Gen template through the Box for Salesforce app may see JSON generation fail. Symptoms include an indefinite loading spinner or a red error banner stating: "JSON string exceeds heap size limit."
Root Cause
The root cause is related to Salesforce platform limits, specifically the Apex heap size limit. The JSON string generated by Box Doc Gen may exceed this heap size limit if the object contains too many fields. This increases the JSON payload beyond what Salesforce can handle in memory during processing, causing the generation process to fail silently or with a heap size error message.
Resolution
While Box for Salesforce has the logic to automatically stop at the heap limit, the error may still occur depending the complexity of the data. In that case, manually adjust the override values in Box Doc Gen to reduce data load per request:
- Doc Gen Fields per Object: Start with 50 fields
- Doc Gen Relationships per Object: Start with 5 relationships
Video recording:
- https://www.loom.com/share/0d406be7c7354cfc81b574adc1ee76ce
- https://cloud.box.com/s/5pmsc96fzdnuhpsu0aqu5pdjfnzxhtmb
After making these changes, you may need to clear the platform cache. Gradually increase the values as needed while monitoring performance and success. If any fields are missing, add them manually to the JSON file.