0

I have an requirement for Large XML file (>16 Mb) Parsing.

Getting error : Error uploading attachment:Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AttachmentManagmentTrigger: execution of AfterInsert caused by: System.StringException: String length exceeds maximum: 6000000 Class.parseXMLClass.loadXML: line 23, column 1 Trigger.AttachmentManagmentTrigger: line 6, column 1: []

At : String bodyContent = .body.toString();

Any help!!

closed as off-topic by Adrian Larson, Himanshu, Sebastian Kessel, Vigneshwaran G, Adam Spriggs Sep 28 '16 at 19:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Adrian Larson, Himanshu, Sebastian Kessel, Vigneshwaran G, Adam Spriggs
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    You're probably going to need to leverage an external service. Maybe build your own on Heroku. – Adrian Larson Sep 28 '16 at 17:57
1

Honestly I don't think there is anything you can do to process a document that large on salesforce directly. You'll need some external system to do some data parsing and pass smaller requests into salesforce.

Even if you were able to split it into multiple strings you'll still likely exceed the heap space governing limit with that one file if you try to manipulate it all in one request.

Not the answer you're looking for? Browse other questions tagged or ask your own question.