You need to sign in to do that
Don't have an account?
llisa
Save and email the respective attachemt but it is not getting attached.
Hello Everyone,
I wrote my function currectly .Functionality was to save the pdf and email it with the respective attachment.
Here it saved but not attached in my email page .
public PageReference attachPdfandEmail()
{
PageReference pdf;
pdf= Page.Quote_PDF;
pdf.getParameters().put('id', selectedQuote);
Blob pdfBlob = Test.isRunningTest() ? Blob.valueOf('UNIT.TEST') : pdf.getContent();
Attachment myAttach = new Attachment();
myAttach.Parentid = quotes.id;
myAttach.name = 'Quote_v'+(totalRecords_Attachment+1)+'.pdf';
myAttach.body = pdf.getContentAsPdf();
insert myAttach;
system.debug(myattach.id);
PageReference ref=new PageReference('/_ui/core/email/author/EmailAuthor?p2_lkid='+acc.id+'&rtype=003&p3_lkid='+quotes.id+'&doc_id='+myattach.id+'&retURL='+quotes.id);
ref.setRedirect(true);
return ref;
}
But while returning the valur the URL changes by itself like :
https://ap2.salesforce.com/_ui/core/email/author/EmailAuthor?doc_id=00P28000006CB6ZEAW&p2_lkid=0012800000EHkmRAAT&p3_lkid=a092800000DdH7ZAAV&retURL=a092800000DdH7ZAAV&rtype=003
Doc id comes firct by itselt and rtype=003 comes last.
please help on this.
I wrote my function currectly .Functionality was to save the pdf and email it with the respective attachment.
Here it saved but not attached in my email page .
public PageReference attachPdfandEmail()
{
PageReference pdf;
pdf= Page.Quote_PDF;
pdf.getParameters().put('id', selectedQuote);
Blob pdfBlob = Test.isRunningTest() ? Blob.valueOf('UNIT.TEST') : pdf.getContent();
Attachment myAttach = new Attachment();
myAttach.Parentid = quotes.id;
myAttach.name = 'Quote_v'+(totalRecords_Attachment+1)+'.pdf';
myAttach.body = pdf.getContentAsPdf();
insert myAttach;
system.debug(myattach.id);
PageReference ref=new PageReference('/_ui/core/email/author/EmailAuthor?p2_lkid='+acc.id+'&rtype=003&p3_lkid='+quotes.id+'&doc_id='+myattach.id+'&retURL='+quotes.id);
ref.setRedirect(true);
return ref;
}
But while returning the valur the URL changes by itself like :
https://ap2.salesforce.com/_ui/core/email/author/EmailAuthor?doc_id=00P28000006CB6ZEAW&p2_lkid=0012800000EHkmRAAT&p3_lkid=a092800000DdH7ZAAV&retURL=a092800000DdH7ZAAV&rtype=003
Doc id comes firct by itselt and rtype=003 comes last.
please help on this.