You need to sign in to do that
Don't have an account?
PageReference method getContent not rendering all repeat tags
PageReference emailTemplate = Page.ProjectInvoiceTrackingEmailTemplate;Blob emailBody = emailTemplate.getContent();System.debug(emailBody.toString());
the template looks like this:
<apex:page id="templatePage" sidebar="false" showHeader="false" controller="ProjectInvoiceEmailController"> <h1>Template header</h1> <apex:repeat value="{!actualProjectsToNotify}" var="project" rendered="true"> <apex:outputText value="{!project.projectName}" /> </apex:repeat> <h3>page end</h3></apex:page>
Does anyone have any ideas why this wouldn't be rendered when calling getContent(), but it is rendered when that same page reference is rendered in the browser?
I haven't had any trouble in my experience with getting page content and including it in an email.
The only difference between my implementations is I do something like:
PageReference emailTemplate = new PageReference(Page.ProjectInvoiceTrackingEmailTemplate.getUrl());
Also, you can create Visualforce email templates. Is there any reason why you haven't gone for this approach?
Hi,
I have similar issue. I have created Visualforce page for generating release notes (using renderAs='pdf' attribute of page tag) and when opened in browser it looks as expected. However, when I want to save it as attachment inside my apex controller using Page.getContentAsPDF, it doesn't include any of data usually rendered by <apex:repeat> tag (that part of page/pdf is missing). Other parts of pdf that use some of controllers data but aren't inside apex repeat tag, like {! myTicketProject.Name}, are rendered as expected.
Hope that someone has figured out why this is happening and can help me. Any kind of idea would be appreciated.
Thank you.