String length exceeds maximum 6000000 in Salesforce
Tuesday, October 31, 2023 at 03:28pmI'm having an issue when sending the pdf to OneSpan. This is the error from the dev console
"String length exceeds maximum: 6000000"
Is this because my files are too large? What's the fix?
Reply to: String length exceeds maximum 6000000 in Salesforce
Tuesday, October 31, 2023 at 04:14pmHi Brian,
Thanks for your post!
Yes, this is because the files are too large. Salesforce has a general heap size limit of 6mb for synchronized call and 12mb for asynchronized call:
https://help.salesforce.com/s/articleView?id=000384468&type=1
If it happens very occasionally, you can try to reduce the size of the documents. Or if you hit the limit often, you can use the Salesforce Future annotation to identify methods that are executed asynchronously so that you get the 12mb limit in this case:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_future.htm
Duo