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

We made a wrong turn. Try again.

i wants to attach pdf as file not as attachments while sending mail it should save in notes and attachments.
2 answers
  1. Sep 6, 2019, 6:05 AM
    // this code is attachment of pdf=====

    public void saveAttachment(){

      String encodedContentsString = System.currentPageReference().getParameters().get('fileContents');

      Id accountId = System.currentPageReference().getParameters().get('accountId');

      

      Attachment attachment = new Attachment();

      attachment.Body = Blob.valueOf(encodedContentsString);

      attachment.Name = String.valueOf('test.txt');

      attachment.ParentId = accountId; 

      insert attachment;

    }

    ==========================//

    If this is my code thn how to attach file as attachment
0/9000