You need to sign in to do that
Don't have an account?
Polayya reddy
Error in apex class:attachmentPDF Error
Hi guys,
i am gettting an error showing that attachment pdf doesnot exit any solution for this.
PageReference pdf = Page.attachmentPDF;
pdf.getParameters().put('id',(String)account.id); pdf.setRedirect(true);
// Take the PDF content Blob b = pdf.getContent();
// Create the email attachment
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('attachment.pdf');
efa.setBody(b);
Thanks
Reddy
i am gettting an error showing that attachment pdf doesnot exit any solution for this.
PageReference pdf = Page.attachmentPDF;
pdf.getParameters().put('id',(String)account.id); pdf.setRedirect(true);
// Take the PDF content Blob b = pdf.getContent();
// Create the email attachment
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('attachment.pdf');
efa.setBody(b);
Thanks
Reddy
Please check "attachmentPDF" visualforce page that you are referring must exist.
PageReference pdf = Page.existingPageName ;
Also you cannot typecast account.id to String as,
account.id - instance of Schema.SObjectField,
and instance of Schema.SObjectField is never an instance of String rather use,
String.valueOf(account.id)
Hope it helps!
First tell me your senerio so i will tell you properly