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

Overriding relatedList

Hello ,

I have a custom object that show as related object on Account page.

Is it possible to override this section with custom visualforce page.


I also have case and contacts list as related list, and several page layouts, that I do not want to modify.


I want to override only the relatedList section that list my custom objects? How can I do that?





You will need to create a Visualforce page to accomplish this functionality. The good news is that it is not too difficult. It should look something like:



<apex:page standardController="Opportunity" extensions="MY_CONTROLLER">

<apex:detail relatedList="false" title="true"/>
<apex:relatedList list="OpportunityLineItems"/>
<apex:relatedList list="R00NR0000000URnZMAW__r"/>
<apex:relatedList list="NotesAndAttachments"/>
<apex:relatedList list="OpportunityHistories"/>



 Hope this helps.


Jeff Douglas
Informa Plc



Thanks for the quick response.


I already have a custom controller and apex page. I am able to add this page to account page layout but I am not able to show this page in relatedlist section.


At the top of the Account page layout I see link to the related objects (case, contact, Note&Attachments, MycustomRelatedList) 

When I scroll down, or click on the link  I see relatedList.  How do I override relatedList so that my apex pages is not showing as another section on page. Instead it show in relatedList.





Ah! Now I think I understand. You can use your standard layout and add your Visualforce page inline. Just remove your custom object's relatedlist from the page layout and then check out this link. It should help you out.


I think that one caveat is that your Visualforce page must implement the standard controller for your object (Account). You can then use a custom controller as an extension.


Jeff Douglas
Informa Plc


Our Org has winter09 upgraded version, where modifying pagelayout UI has been changed.


My controller pages showup in VisualForce pages, but I cannot drop the myVFpage under realtedList section.

When I look in "Related Lists" I do not see my VFPage.


My apex page does use standardcontroller 

    <apex:page standardController="Account" extensions="MyCustomController">
and my controller implements standard controller.

  Public class MyCustomController{
  private final Account stdAcct;
  private ApexPages.StandardController controller;
    public MyCustomController(ApexPages.StandardController stdcontroller){

    this.stdAcct = [select Id,nameFROM Account wher ID= '001S0000004cdSl'];


I want override the link for Related list. sample link for relatedlist for account ID -001S0000004cdSl

sample link for related list=

for contacts related list = https://test.salesforce.com001S0000004cdSl#001S0000004cdSl_RelatedContactList_target

for my custom list -


Hope I am clear in my requirement. I really appreciate your insight.