You need to sign in to do that
Don't have an account?
Aaron Wallace
I am trying to create a pdf from the Lead Object in Salesforce using the Apex language. I am able to create the pdf and attach it to the Current Lead but it does not pull in any of the information from the Lead into the PDF itself.
Apex:outputfield not outputting anything on VisualForce Page
I am trying to create a pdf from the Lead Object in Salesforce using the Apex language. I am able to create the pdf and attach it to the Current Lead but it does not pull in any of the information from the Lead into the PDF itself.
Page Code: <apex:page standardController="Lead" renderAs="pdf" showHeader="false"> <apex:stylesheet value="{!$Resource.pdfCss}"/> <apex:panelGrid columns="1" width="100%"> <apex:outputField value="{!Lead.Name}" styleClass="companyName"/> <apex:outputText value="{!NOW()}"></apex:outputText> </apex:panelGrid> </apex:page> Class Code: public class attachPDFToLead { private final Lead a; public attachPDFToLead(ApexPages.StandardController standardPageController) { a = (Lead)standardPageController.getRecord(); } public PageReference attachPDF() { PageReference pdfPage = Page.PDF; Blob pdfBlob = pdfPage.getContent(); Attachment attach = new Attachment(parentId = a.Id, Name = 'insuranceVerification.pdf', body = pdfBlob); insert attach; PageReference pageURL = new ApexPages.StandardController(a).view(); pageURL.setRedirect(true); return pageURL; } }
How you are calling this page, you are passing parameter of lead id?