You need to sign in to do that
Don't have an account?
PamSalesforce
Using custom button to generate a pdf and send it as an attachment in email
Hi,
I need to add a custom button on a detail field that create a pdf document using the custom object data
and send a mail using a mail template with the created pdf document in attachement.
Can anyone suggest me how to implement this.
Thanks,
Hi,
I had faced this issue but it is solved now.
This is how i implemented it:
I created a custom button with javascript code on it to call the webservice method. This web sercvice method in gets the visualforce page which is rendered as PDF, attaches this pdf to the outbound email and sends the email.
Here is the code:
code on custom button:
{!requireScript("/soap/ajax/16.0/connection.js")}
{!requireScript("/soap/ajax/16.0/apex.js")}
var idLead = '{!Lead.Id}';
sforce.apex.execute("sendPDFEmailClass","emailPdf",{a:idLead });
the sendPDFEmailClass
and the visualforce page should have renderAs="pdf" in <apex:page>..
This worked for me.
Hope this helps those who are facing problems similar to this.
All Answers
Hi,
I had faced this issue but it is solved now.
This is how i implemented it:
I created a custom button with javascript code on it to call the webservice method. This web sercvice method in gets the visualforce page which is rendered as PDF, attaches this pdf to the outbound email and sends the email.
Here is the code:
code on custom button:
{!requireScript("/soap/ajax/16.0/connection.js")}
{!requireScript("/soap/ajax/16.0/apex.js")}
var idLead = '{!Lead.Id}';
sforce.apex.execute("sendPDFEmailClass","emailPdf",{a:idLead });
the sendPDFEmailClass
and the visualforce page should have renderAs="pdf" in <apex:page>..
This worked for me.
Hope this helps those who are facing problems similar to this.
I m facing the same issue here.
Any further help with an example is much appreciated.
Thanks,
VK
Hello Pam,
I tried to implement the code which you provided by changing the variables for this issue here
I am a newbie to the apex programming thing and recently started learning more about this.
Thanks for your quick reply and any help is much appreciated.
Thanks,
Vinay
Here is a blog on emailing VF as attachment. Hope this helps.
http://blog.sforce.com/sforce/2008/06/emailing-visual.html
Thanks a lot Pam...
Thanks in advance