apex:relatedList

A list of Salesforce records that are related to a parent record with a lookup or master-detail relationship.

Example 

1<!-- For this example to render properly, you must associate the Visualforce page
2with a valid account record in the URL.
3For example, if 001D000000IRt53 is the account ID, the resulting URL should be:
4https://MyDomain_login_URL/apex/myPage?id=001D000000IRt53
5See the Visualforce Developer's Guide Quick Start Tutorial for more information. -->
6
7
8<apex:page standardController="Account">
9    <apex:pageBlock>
10    You're looking at some related lists for {!account.name}:
11    </apex:pageBlock>
12
13    <apex:relatedList list="Opportunities" />
14
15    <apex:relatedList list="Contacts">
16        <apex:facet name="header">Titles can be overriden with facets</apex:facet>
17    </apex:relatedList>
18
19    <apex:relatedList list="Cases" title="Or you can keep the image, but change the text" />
20</apex:page>

Attributes 

Attribute NameAttribute TypeDescriptionRequired?API VersionAccess
idStringAn identifier that allows the relatedList component to be referenced by other components in the page. 10.0global
listStringThe related list to display. This does not need to be on an object’s page layout. To specify this value, use the name of the child relationship to the related object. For example, to display the Contacts related list that would normally display on an account detail page, use list=“Contacts”.Yes10.0global
pageSizeIntegerThe number of records to display by default in the related list. If not specified, this value defaults to 5. 10.0global
renderedBooleanA Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. 10.0global
subjectStringThe parent record from which the data and related list definition are derived. If not specified, and if using a standard controller, this value is automatically set to the value of the ID query string parameter in the page URL. 10.0global
titleStringThe text displayed as the title of the related list. If not specified, this value defaults to the title specified in the application. 10.0global

Facets 

Facet NameDescriptionAPI Version
bodyThe components that appear in the body of the related list. Note that the order in which a body facet appears in a relatedList component does not matter, because any facet with name=“body” will control the appearance of the related list body. If specified, this facet overrides any other content in the related list tag.10.0
footerThe components that appear in the footer area of the related list. Note that the order in which a footer facet appears in the body of a relatedList component does not matter, because any facet with name=“footer” will control the appearance of the bottom of the related list.10.0
headerThe components that appear in the header area of the related list. Note that the order in which a header facet appears in the body of a relatedList component does not matter, because any facet with name=“header” will control the appearance of the top of the related list.10.0