+ Start a Discussion
RajManiaRajMania 

Display of related List with Custom Controller

By Using <apex:relatedList list="" /> with Standard controller , related list automatically come the screen. Can any body have any idae how it will work if we are using custom controller. or is any documentation how exactly this tag is working.

Thanks inAdvance,

Raj

Best Answer chosen by Admin (Salesforce Developers) 
RajManiaRajMania

Hi Thanga,

              Thanks, it fixed my problem, actually I was missing the Subject tag. Your timely reply helped me a lot

 

Regards,

Raj

All Answers

thangasan@yahoothangasan@yahoo

Hai

 

  Check salesforce_pages_developers_guide.pdf "Displaying Related Lists for Custom Objects" Page 20

 

<apex:page standardController="MyMasterObject__c">
<apex:relatedList list="MyChildObjects__r" />
</apex:page>

 

Give custom control relationship name , In the child Object Lookp field you need to give Child Relationship Name.

 

Thanks

Thanga

RajManiaRajMania

Thanks Thanga, for fast replying,

Actually I am using custom controller and my code like this

<apex:page Controller="SalesSupportCustom">

<apex:relatedList list="MyChildObjects__r" /> 

and in this scenario it will not work, my question what change I should make in my controller

 

Regards,

Raj

 

thangasan@yahoothangasan@yahoo

Hai Raj

 

// Controller

 

public class SalesSupportCustom
{
    SampleCustom__c sample;
     public SampleCustom__c getSample() {
        return sample;
    }
   
    public void setSample(SampleCustom__c sample ){
      this.sample  = sample ;
    }
     public SalesSupportCustom(){
         sample = [select id, name from SampleCustom__c where id = :ApexPages.currentPage().getParameters().get('id')];
     }
}

 

//Page

 

<apex:page Controller="SalesSupportCustom" tabStyle="SalesSupportCustom__c">
    <apex:detail relatedList="false" title="true"/>
    <apex:relatedList subject="{!sample}" list="SalesSupportCustoms__r" />
</apex:page>

 

 

For Testing

  https://        //apex/PageName/?id=a0NS000000065Ec

 

Regards

Thanga

 

RajManiaRajMania

Hi Thanga,

              Thanks, it fixed my problem, actually I was missing the Subject tag. Your timely reply helped me a lot

 

Regards,

Raj

This was selected as the best answer
ANTONIO MORILLOANTONIO MORILLO
Hi,

¿Is it possible to see the related lists in lighning style with this method?

Regards,
Thanks.