You need to sign in to do that
Don't have an account?
Ankita Gupta 65
apex heap size too large error in APEX REST
Hi All,
I have created an APEX REST service to insert few records in custom object and few attachments. The service works fine for multiple attachments of size ~60KB. However, when attachments of size ~2MB is sent, we get an error 'Apex heap size too large'. I have a requirement where multiple attachments of size ~3MB should be inserted using REST API. Please help.
I have created an APEX REST service to insert few records in custom object and few attachments. The service works fine for multiple attachments of size ~60KB. However, when attachments of size ~2MB is sent, we get an error 'Apex heap size too large'. I have a requirement where multiple attachments of size ~3MB should be inserted using REST API. Please help.
So can you modify your code to only ask 1 attachment at a time.
The attachment could be either 60 KB or 3 MB.
In this way you will never hit Heap Memory limit...
If for some reason , you cannot modify your code to limit the transaction to 1 attachment, ask the sender ( developer of the other system with which SFDC is integrating) to send only 1 attachment per request from SFDC.
This is the only solution I can think of at this time.
Thanks for your response. Can you help me understand how can I limit it to 1 attachment since I'm at the end where we are writing the service. Since we are getting 1 json that includes all the records for different objects and attachments