I have a custom object named: Digest. I have another custom object named: Interesting_Fact. A User can have many Digests. And a Digest can have many interesting facts. I am sending out information about digests and interesting facts to all users in emails using a Visual force template.
In my visual force template I pull in Digest by doing:
<messaging:emailTemplate subject="Daily Digest" recipientType="User" relatedToType="Digest__c">
This works.
However, I want to display a table for all the interest facts for each digest. I do:
<table border="1">
<tr >
<th>Opportunity</th><th>Interesting Fact</th>
</tr>
<apex:repeat var="fact" value="{!relatedTo.Interesting_Facts__c}">
...
But I get:
Error: Invalid field DM_Interesting_Facts__c for SObject Digest__c
I relationship is defined as a lookup, from Interesting_fact to Digest. I check this relationship and it tell me:
Child Relationship Name: Interesting_Facts
So I can't understand how I get this error. I also try, Interesting_Facts i.e. removing __c but this gives same error.
Any ideas?
__r
instead of__c
? Generally speaking - experiment with form that would be also a valid subquery, I suspectSELECT Id, (SELECT Id FROM Interesting_Facts__r) FROM Digest__c LIMIT 10
.