Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Displaying Related Lists for Custom Objects

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

Important

Displaying custom objects and their related lists with Visualforce is very simple.

Suppose you have three custom objects: MyChildObject, MyMasterObject, and MyLookupObject. MyChildObject has a master-detail relationship with MyMasterObject (which is the master). MyLookupObject also has a Lookup relationship with MyChildObject.

If you want to create a Visualforce page that displays the related list for MyMasterObject, use the following markup:
1<apex:page standardController="MyMasterObject__c">
2	<apex:relatedList list="MyChildObjects__r" />
3</apex:page>

For this page to display the related list data, the ID of a valid custom object record with a custom relationship must be specified as a query parameter in the URL for the page, for example, http://MyDomain_login_URL/myCustomRelatedList?id=a00x00000003ij0.

Although MyLookupObject uses a different type of relationship, the syntax is identical:
1<apex:page standardController="MyLookupObject__c">
2	<apex:relatedList list="MyChildObjects__r" />
3</apex:page>