+ Start a Discussion
avimeiravimeir 

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?

 

Tried 

    <apex:relatedList list="Services" />

 But nothing shows.

 

Thanks

bob_buzzardbob_buzzard

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

 

<apex:relatedList list="Services__r"/>

 

avimeiravimeir

Doesn't work.

 

Just to clarify, I have the following custom objects:

 

Reservation__c

Service__c

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

 

 

bob_buzzardbob_buzzard

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

avimeiravimeir

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="window.top.close();"/><apex:commandButton value="Check Out" style="margin-left: 10px;" action="{!checkOut}" onclick="window.top.close();"/>

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

    </apex:pageBlock>
</apex:page>

 

bob_buzzardbob_buzzard

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