You need to sign in to do that
Don't have an account?
EmailAuthor.jsp - Trouble with attachment via a component with Visual Force Template
I have a visual force email template that uses a component to place an attachment into an email. I also have code in my application that transitions to the the EmailAuthor.jsp page using a url that looks like this:
As you can see, I am providing a whatId and a template id.
When I arrive at the EmailAuthor page, at first glance everything looks good. I see text from my template in the body and I see data from my relatedTo record properly merged into the email. Unfortunately though, the attachment does not appear. If I then click on the button to "select a template" and then choose the template that was provided in the above url, the page refreshes and the attachement is now shown on the page. Of course, the whole reason why I provided the template id in the url was so the user doesn't have to select it.
Has anyone encountered this problem before and found a way to resolve it?
My template looks like:
<messaging:emailTemplate subject="Past Due Balancexx" recipientType="Contact" relatedToType="DunningNoticeQueue__c">
<messaging:htmlEmailBody >
<br><apex:image value="{!relatedTo.Image_1_Web_Address__c}" />
<br><br><br>Dear {!recipient.firstName}:
<br><br>This is to inform you that you owe: {!relatedTo.AR_Summary_Unworked__r.Total_AR_Balance__c}
<br><!apex:image value="{!relatedTo.Image_1_Web_Address__c}" />
</messaging:htmlEmailBody>
<messaging:attachment renderAs="application/vnd.ms-excel" filename="invoices" >
<c:DunningInvoiceAttachment dunningQueueId="{!relatedTo.Id}"/>
</messaging:attachment>
</messaging:emailTemplate>
All Answers
Thanks. This works.