function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sridhar NarayansaSridhar Narayansa 

Transaction Heapsize Limit for File scan

Hello,

We are introducing communities for customer service. We have users the ability to create a Case and ability to attach a file to a case.
This cases and files are later accessed by internal agents.

Since salesforce does not guaratee that files attached by customers are free from malware, our organization requires that all attachments uploaded by customer be scanned using Internal pre-approved virus scanning tool. For this we have to call an API which performs the virus scan using REST API. We are not allowed to use any third party app exchange products.

While calling REST API for virus scan, we are converting file to base64 encoded file in the payload. This works fine for small files.

For files that is larger, we are hitting Heapsize limit defined by Salesforce.

Ideally, we want files as large as 20MB be available to be processed using REST API. How can I process large files in Apex transaction?

Does anybody have any workaround?
Any other ideas on how other places have performed virus scan on attachments for community users?

Thanks.,
Sridhar

 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Sridhar,

Have you considered a multipart request for larger files, please check the below dev forum thread once:

>> https://developer.salesforce.com/forums/?id=9060G0000005gwNQAQ

Hope this helps and incase if this came in handy can you please choose this as best answer so that it can be used by others in the future.

Regards,
Anutej
Sridhar NarayansaSridhar Narayansa
Thanks Anutej. I believethis is the only option if we want to scan using API.