+ Start a Discussion
etessetess 

Displaying a Related list using apex:repeat or apex:dataList

I am trying to create a VF page that will eventually be rendered as a PDF.  I have a Related list that displays correctly using apex:relatedList, however, I am trying to display it using apex:repeat or apex:dataList so that I can format the PDF. But when I try to use apex:repeat or apex:dataList, I get the following error:

 

Error: ; nested exception is: common.exception.ApiQueryException: ....... If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

 

I know I am referring to the custom relationship correctly because the Related List displays.

 

The standard controller is Quote. The related list is Custom Objects that are children of the Opportunity.

 

  • My related list code looks like this:
         <apex:relatedList list="{!quote.Opportunity.CustOBJ__r}"}
  • My apex:repeat looks like this:
         <apex:repeat value="{!quote.Opportunity.CustOBJ__r}" var="cx">
            <apex:outputText value="{!cx.name}"/>
        </apex:dataList>

Any ideas why this would be happening?

hisrinuhisrinu

In your case you are giving the relationship name as wrong... go to the lookup field in the setup and find out the relationship name and add with __r, this should work.

 

<apex:repeat value="{!quote.Opportunity.CustOBJ__r}" var="cx">
        <apex:outputText value="{!cx.name}"/>
    </apex:repeat>

etessetess

I checked and definitely have the correct relationship name.That's why I thought the related list works..

Do you think the issue is that the controller is Quote and I'm trying to access a child (custom) of it's Parent (opportunity)?