function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

how to attach notes and attachments from opportunity to my visual force email template



Can someone guide me how to include attachments from Opportunity page into my visual force email template.


I am doing something like this ....

<messaging:emailTemplate subject="There is no subject" recipientType="Contact" relatedToType="Opportunity">
<messaging:htmlEmailBody >


 <messaging:attachment renderAs="pdf" filename="test.pdf">


<apex:repeat value="{!relatedTo.Attachments}" var="na">




I get some error ...


Error: ; nested exception is: common.exception.ApiException: Binary fields cannot be selected in join queries


Thanks in advance


Chirag MehtaChirag Mehta

Were you able to solve this issue? (there are workarounds, but I want to see if there's a direct solution or not).


Hi Chirag ,


Could you please share a work around ? I am also facing the same issue.


Thanks in advance for your help.