You need to sign in to do that
Don't have an account?
llisa
URL Code for editing a Task
Hii Everyone,
Here i am tried to redirect the button to standard Task page after saving.
It displays an error that EmailAuthor page not found Plz help on this .
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'+(attachments.size()+1)+'.pdf';
myAttach.body = pdf.getContentAsPdf();
insert myAttach;
system.debug(myattach.id);
PageReference ref=new PageReference('/apex/_ui/core/email/author/EmailAuthor?p2_lkid='+acc.id+'&rtype=003&p3_lkid='+quotes.id);
ref.setRedirect(true);
return ref;
}
Here i am tried to redirect the button to standard Task page after saving.
It displays an error that EmailAuthor page not found Plz help on this .
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'+(attachments.size()+1)+'.pdf';
myAttach.body = pdf.getContentAsPdf();
insert myAttach;
system.debug(myattach.id);
PageReference ref=new PageReference('/apex/_ui/core/email/author/EmailAuthor?p2_lkid='+acc.id+'&rtype=003&p3_lkid='+quotes.id);
ref.setRedirect(true);
return ref;
}
If this won't help you probably you have to create a custom send email VF page with custom lookup functionalities as posted http://salesforce.stackexchange.com/questions/60763/why-doesnt-file-location-lookup-show-attachments-of-opportunity/60776#60776
Let me know, If this helps you.
Thanks for the reply. It works but here i got another problem like-----------
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.
I have never face such issue but you can checkout below link may be you get what you need.
https://success.salesforce.com/answers?id=90630000000goIfAAI
OR
Replace your code with below code:
If this helps you, Mark it as Best Answer.
Here i create Quote as a custom object,so my 'quotes.id' is the custom Quote object record id. So is it possible that the standard Email Task page unable to relate the Custom object attachment into it ?
Because here i gave the URL perfectly and checked with standard URL also,it is same.