0

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?

1
  • 1
    Try with __r instead of __c? Generally speaking - experiment with form that would be also a valid subquery, I suspect SELECT Id, (SELECT Id FROM Interesting_Facts__r) FROM Digest__c LIMIT 10.
    – eyescream
    Nov 21, 2012 at 16:54

2 Answers 2

2

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

2

From your Eclipse find the Child relationship name and use the same here.

enter image description 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.

5

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .