Is it possible to create a related list with custom data? I've built a visual force page with a controller extension that contains an apex page block iterating over a List of custom objects built from the controller extension:


<apex:page standardController="Account" extensions="MyTestController">
    <apex:pageblock id="testList" title="Test List"  >
        <apex:pageBlockTable value="{!items}" var="i" rendered="{!NOT(ISNULL(items))}">
            <apex:column value="{!i.Id}"/>
            <apex:column value="{!i.Name}"/>
        <apex:outputLabel value="No records to display" rendered="{!(ISNULL(items))}" styleClass="noRowsHeader"></apex:outputLabel>


public class MyTestController {
    private Account acct; 
    List<Item__c> items; 
    public MyTestController(ApexPages.StandardController controller) {
        this.acct= (Account)controller.getRecord();

    public List<Item__c> getItems()
         List<Item__c> items = [select id, name from Item__c where account_id = :acct.id];
         return items;

The above renders when I use the 'Edit Layout' on the Account page, then add the VF Page to the detail, but I am unable to add it in the related list area. The rendered table in the detail area looks similar to the sections in the Related List section, but I'd really rather have the look and feel of an actual Related List instead of a pageBlockTable.

  • Why do you need to look at a list of Visualforce Pages? Can't you look at a list of objects? That will work fine. You can even set things up so a link in your pageTableBlock takes you to a VF page for that object.
    – Jagular
    Mar 16, 2017 at 20:58

2 Answers 2


You cannot add visualforce page as a related list.Need to override full page

Example 1

<apex:page standardController="Account">
    You're looking at some related lists for {!account.name}:

    <apex:relatedList list="Opportunities" />

    <apex:relatedList list="Contacts">
        <apex:facet name="header">Titles can be overriden with facets</apex:facet>

    <apex:relatedList list="Cases" title="Or you can keep the image, but change the text" />

Example 2

<apex:page standardcontroller="Account"> 
    <apex:detail relatedList="false" />
    <c:someComponent ... />
    <apex:relatedList list="Contacts" />
    <apex:relatedList list="Cases" />
    <apex:relatedList list="Opportunities" /> 

Please check this link Custom Related List and Visual Force Page?

Also please vote this idea Ability to build custom related list in Visualforce

  • Thanks @sfdc, if I override the entire page, could I then include a related list for the custom object?
    – dbcn
    Mar 16, 2017 at 20:24
  • Yes,You can.Please check above examples
    – sfdc
    Mar 16, 2017 at 20:27
  • Sorry - I'm not seeing it - all the related lists in your example are for Standard Objects.
    – dbcn
    Mar 16, 2017 at 21:10

You can only add Visualforce pages in the detail section, not in the related list area. Realistically, your best choice at this point is to switch to Lightning, where you can add components pretty much anywhere you want to. I'm pretty sure I saw an Idea for this previously, but I can't seem to find it (future visitors: if you find a link, please feel free to add it).

Ability to build custom related list in Visualforce

  • Please check to ensure the link I added is the one you were thinking of
    – Eric
    Mar 16, 2017 at 22:32
  • @Eric It's kind of the one I was thinking of, but I'm almost certain now it's something I dreamed up one day and forgot to post. Of course, it'll never happen now because Lightning, but I do think that idea would suffice for most purposes I had in mind.
    – sfdcfox
    Mar 16, 2017 at 22:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .