You need to sign in to do that
Don't have an account?

Possible to show related list of another object in visualforce email template?
Our accounts object has 2 related lists (contacts & commitments). I need to send an email to a certain list of contacts where the email references data from the contact's Account record and displays the account's related list for commitments.
If I change the relatedToType to account, I no longer get the error message, but when I send the template from a contact record, it doesn't populate. Seems what I'm looking for should be easy to do, but I cannot get it to work. Any ideas???
I keep getting the following error message:
Error: Aggregate Relationship is used in an unsupported complex expression containing 'Account.r00na00000035kqema2__r' |
Here is the visualforce email template I'm trying to use:
<messaging:emailTemplate subject="Commitments" recipientType="Contact" relatedToType="contact">
<messaging:htmlEmailBody >
<html>
<body>
LP Commitments for the
<apex:outputText value="{!relatedto.account}" escape="false"/>
<table border="2" width="100%">
<tr >
<th>Internal Fund</th><th>Amount</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.account.commitments__r}">
<tr>
<td>{!cx.Internal_Fund__c}</td>
<td>{!cx.Commitment__c}</td>
</tr>
</apex:repeat>
</table><br></br>
</body></html>
</messaging:htmlEmailBody>
Here's another thought:
Is it possible to set the whatid to a specific record? I know I can list the RelatedToType as Account, but can I somehow say: RelatedToRecord = contact.accountid?
We want to use this template in an email blast, so we will always be selecting the contacts, but not the accounts. If there was a way to specify that email's whatid should always be the contact's account, then we could bypass this whole problem.
Thanks again!!