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?
Attribution to: dublintech
Possible Suggestion/Solution #1
Are you referencing *DM_*Interesting_Facts__c in your page /controller somewhere ?
I see that the name is Interesting_Facts__c
/try using Interesting_Facts__r since it is a related object use
Attribution to: Rao
Possible Suggestion/Solution #2
From your Eclipse find the Child relationship name and use the same here.
The Call is My Parent Object and Call_Detail__c my child Objects.Observe the arrows and we get the Child relationship name .
Use Childnrelationship Name Properly to resolve this.
Attribution to: Mohith Shrivastava
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4657