Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
Hi,

I am getting this Error "String length exceeds maximum: 6000000" while I am converting Body of an attachment to String.

Please find my code and Screen shot.

Please help me, how to fix this error.

 

Code:-

reportAttachment = [SELECT Id, Name, Body, ContentType FROM Attachment WHERE ParentId = :idReport];

    public string getReportBody() {

        return reportAttachment.get(0).Body.toString();

    }

Screen Shot:-

 User-added image
4 answers
  1. Jun 16, 2016, 2:47 PM
    You needs to reduce the maximum file size that's only the solution.
Loading
0/9000