Hello, I have created a flow ,visualforce page ,email template ,email alert for generating pdf but i want what pdf is generating it will also save in notes and attachment of particular account here I'm not getting how to save the pdf in notes & attachment
public void attach() {
Attachment myAttach = new Attachment();
myAttach.ParentId = 'xxxxxxxxxx';//Id of the object to which the page is attached
myAttach.name = 'DisplayName.pdf';
PageReference myPdf = Page.myPdfPage;//myPdfPage is the name of your pdf page
myAttach.body = myPdf.getContentAsPdf();
insert myAttach;
}
Try this Reference Link (https://developer.salesforce.com/forums/?id=906F00000008xLrIAI)
Kindly mark it as the best answer if it works for you.
Thanks & Regards,
Priya Ranjan