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> 

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"/>  

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 :-)


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"/> 


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.