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

Adding related list to custom VF page

Hi all,


I have an object Services that connects two custom objects using master-detail relationship.


I've built a VF page and want to add a related list for this object. How do I do it?



    <apex:relatedList list="Services" />

 But nothing shows.




I'd expect you to have to use the custom relationship name:


<apex:relatedList list="Services__r"/>



Doesn't work.


Just to clarify, I have the following custom objects:




ReservationServiceJunction__c    ===> This one connects to Reservation__c and to Service__c using master-detail 


I am building a VF page that uses the Reservation__c controller , and there I want to show all ReservationServiceJunction__c objects that have the current Resertvation__c as object




So I'd expect the related list to be 'ReservationServiceJunction__r'.


I tried, still doesn't work. Here's the full page code:


<apex:page standardController="Reservation__c" extensions="ReservationController">
    <apex:pageBlock title="Check Out">
        <apex:form >
                <apex:outputText value="Deposit paid: " /> <apex:outputField value="{!resa.Deposit__c}" />
                <br /><hr />
                <apex:outputText value="To be paid by guest: " /> <apex:outputField value="{!resa.Amount_Due__c}" />   
                <apex:outputLabel value="{!checkOutWarning}" style="color: red; margin-left: 15px" />
                <br />
                <apex:commandLink value="Cancel" onclick=";"/><apex:commandButton value="Check Out" style="margin-left: 10px;" action="{!checkOut}" onclick=";"/>

        <apex:relatedList list="Service_To_Reservation__r" />  <!--  DOESNT SHOW -->




Have you verified the name of the related list using the schema explorer?