function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC RocksSFDC Rocks 

apex:relatedList - how to specify a list that uses a mapping custom object?

I use a custom object that I am using to map the following two fields, let's call this mapping custom object "EFMAP":
field 1: a master-detail relationship with a custom object called "sentity"
field 2: a lookup relationship with a custom object called "sfield"
For sfield's view page, I want to have a related list to the "sentity" objects that it maps to.
I've been trying different things, and I keep getting errors about the relationship being wrong.
Can anyone provide any insight into how I should specify this in my apex page?
 <apex:relatedList list="???"/>
I built a similar page using Setup, and in the layout XML, it states
The value for that attribute is the ChildRelationship name. Your lookup field definition should have this value. Navigate to your custom field definition detail page for the lookup field on EFMAP pointing to sfield.  If you see no value there you need to specify one. Generally the best idea is to use the related list label as inspiration for the name. So if the label is "EFMAP Records" then name it "EFMAP_Records".  If that's the child relationship name then the value you put in RelatedList.List would be "EFMAP_Records__r".

The ChildRelationship name should be set automatically when you create the relationship but there has been a hard to kill bug with that. Whenever you define a lookup or master-detail relationship always assure the child relationship name is set to avoid future issues.

SFDC RocksSFDC Rocks
Thanks.  That worked.