I am trying to develop a small VF page that will eventually be added to the standard SF page for a custom object called Test_Site__c
.
Test_Site__c
contains a lookup relationship to an object called ELTON__Other__c
.
I wrote the following VF page and it works fine.
<apex:page standardcontroller="Test_Site__c"> <p>Site {! Test_Site__c.Description__c }.</p> <p>Other {! Test_Site__c.ELTON_Other__r.Name }.</p> </apex:page>
That displays a certain Test Site with it’s associated ELTON Other name. That makes me think that I have the 2 objects correctly related.
And if I take Test_Site__c
out of the equation I can write the page that I want for the lookup ELTON__Other__c
object…
<apex:page standardcontroller="ELTON__Other__c"> <p>Other {! ELTON__Other__c.Name }.</p> <apex:relatedList list="ELTON__Equipment__r"/> <apex:relatedList list="ELTON__Equipment_Assignments__r"/> <apex:relatedList list="ELTON__Equipment1__r"/> <apex:relatedList list="ELTON__Equipment_Loans__r"/> </apex:page>
That too works wonderfully in that it displays 4 related lists for an ELTON__Other__c
object
Since a Test_Site__c
record only ever has either 0 or 1 ELTON__Other__c
records related to it I would like to display the 4 related lists from ELTON_Other__c
and display them on the related Test_Site__c
page (so meaning add the lists to the tiny first page example above).
Is this even possible?
Thanks in advance for any insight you could provide 🙂
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Yes, it is possible. For that just use a subject
parameter of the apex:relatedList
tag:
<apex:page standardcontroller="Test_Site__c"> <p>Site {!Test_Site__c.Description__c }.</p> <p>Other {!Test_Site__c.ELTON_Other__r.Name }.</p> <apex:relatedList subject="{!Test_Site__c.ELTON_Other__c}" list="ELTON__Equipment1__r"/> </apex:page>
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0