You need to sign in to do that
Don't have an account?
Priya Aakanksha
how to create attachments as files using apex in salesforce
i wants to attach pdf as file not as attachments while sending mail it should save in notes and attachments.
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Greetings to you!
Please refer to the below links which might help you further with the above requirement.
https://www.biswajeetsamal.com/blog/convert-attachment-to-file-in-salesforce-using-apex/
https://vivekdeepak.wordpress.com/2017/07/05/upload-files-as-attachment-using-apex-salesforce/
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_email_sending_attachments.htm
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
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