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
RyanhRyanh 

Valid Opportunity Related Lists

I need to display the Opportunity Products related list on a VF page with a custom controller. I don't know the exact name of the list though, and I can't find a reference for each of the standard object's valid related lists. Here's the code I'm using on the page:

 

<apex:relatedList subject="{!opportunity}" list="OpportunityProducts" title="Products"/>

 

And I get an error saying:

'OpportunityProducts' is not a valid child relationship name for entity Opportunity

 

I've tried "Products", "OpportunityProducts", and "Opportunity Products". Again, if someone could point me to the list of all available related lists -- or how to find it through debugging -- I would appreciate it.

Best Answer chosen by Admin (Salesforce Developers) 
TehNrdTehNrd
I believe it is OpportunityLineItems

All Answers

TehNrdTehNrd
I believe it is OpportunityLineItems
This was selected as the best answer
RyanhRyanh
Yeah, that's it -- Thanks. Strange that it's not OpportunityLineItem since that's the object name. I'll follow that pattern in the future. Appreciate it.
AlexYAlexY

I'm having a similar issue with Campaign Members

 

Does not seem to like CampaignMember, CampaignMembers and various variants inbetween

 

Any help would be much appreciated from this VF newbie

newbiewvfdevnewbiewvfdev

Hi there,

 

I just came across exactly the same issue. I was wondering if you could share with me how you came to fix this. Thank you very much.

 

 

CTU007CTU007
you can use apex explorer to check for child relationship names...