I am following this SF VF email example.
They have the relatedToType="Account"
and their <apex:repeat var="cx" value="{!relatedTo.Cases}">
references Cases which should loop through the Cases related to Account - Being a one to many relationship. I can make this work fine.
When I change the relatedToType="Contact"
and my <apex:repeat var="cx" value="{!relatedTo.MyCustomObject__r}">
which is also a one to many relationship I get the following error on trying to save the template:
Error: Invalid field MyCustomObject__r for SObject Contact
I have also tried __c but with the same error.
Any ideas?
UPDATE:
The accepted answer below (and comments) worked for me. I was focusing on the related 'object' not the 'field' that actually related them both together.
{!relatedTo.MyCustomObjects__r}
. You can see the child relationship name, by going to the lookup field, it's at the bottom left. – rael_kid Jan 8 '16 at 12:42