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
davidrmodavidrmo 

Including list of Opportunities in email template

Hello. We are using the non-profit starter pack, and would like to send each donor (aka Contact) an email listing all of their donations (Opportunities) so far this year. I was told that I'd need to create a Visual Force email template to do this. I'm new to VF, but I do have experience with other programming languages, so just need some help getting started. 

 

Can someone please point me to an example of how to include a list of donations (aka Opportunities) as a merge field in the body of a mass email? 

 

Thanks in advance,
 

David



Pan_AKPan_AK

Please use the following code sippnet  it will display all the Opportunity Related with the specific contact

 

<messaging:emailTemplate recipientType="Contact"
relatedToType="Account"
subject="Opportunity report for Contact: {!relatedTo.name}"

replyTo="support@acme.com">
<messaging:htmlEmailBody>
<html>
<body>
<p>Dear {!recipient.name},</p>
<p>Below is a list of cases related to {!relatedTo.name}.</p>
<table border="0" >
<tr>
<th>Case Number</th><th>Origin</th>
<th>Creator Email</th><th>Status</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.Opportunities}">
<tr>
<td><a href =
"https://na1.salesforce.com/{!cx.id}">{!cx.Name}
</a></td>
<td>
 {!cx.Description}
</td>

</tr>
</apex:repeat>
</table>
<p/>
<center>
<apex:outputLink value="http://www.salesforce.com">
For more detailed information login to Salesforce.com
</apex:outputLink>
</center>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>