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
Nancy Ngo ^ ParkerNancy Ngo ^ Parker 

Is there a way to add OportunityLineItemSchedule (Opportunity Product) Related List to Contracts object Visualforce Page - Receiving "Content cannot be displayed: 'OpportunityProduct__r' is not a valid child relationship name for entity Contract" error me

Is there a way to add OportunityLineItemSchedule (Opportunity Product) Related List to Contracts object Visualforce Page - Receiving "Content cannot be displayed: 'OpportunityProduct__r' is not a valid child relationship name for entity Contract" error message.  I created a lookup relationship from Opportunity Product to Contracts object, and still receiving this error.

Here is my outputpanel code.  The only related list, when added, that does not work is the last one (    <apex:relatedList list="OpportunityLineItemSchedule__r"/> )


<apex:outputpanel >
     <apex:relatedlist list="ProcessSteps" title="Approval History"/>
        <apex:relatedlist list="Contracts__r" title="Contracts"/>
      <apex:relatedlist list="OpenActivities" title="Open Activities"/>
        <apex:relatedlist list="ActivityHistories" title="Activity History"/>
     <apex:relatedList list="OpportunityLineItemSchedule__r"/>
     </apex:outputpanel>
Danish HodaDanish Hoda
just try Opportunities.
<apex:relatedList list="Opportunities"/>
Nancy Ngo ^ ParkerNancy Ngo ^ Parker
I do not need "Opportuntiies" related list in my Contracts VF page layout.  It is the "Opportunity (Products)" related list that I need to show up in my Contracts Visualforce page layout.  Ideally, the opportunity linked to the contract (and in which has Opportunity Products added on an Opportunity) should display accordingly in my VIsualforce page as a related list in Contracts.
Danish HodaDanish Hoda
You can create a custom field on Opportunity Product object lookup to Contract, and use the Child-relationship-name__r on the VF page.
Nancy Ngo ^ ParkerNancy Ngo ^ Parker
Danish - I already have a custom lookup field on Opportunity Product object to Contract object, however, that does not solve the issue.  I need to include an <apex:relatedList list=""/> (that actually works) onto the Contract-object Visualforce page that shows the linked Opportunity>Opportunity Product RELATED LIST that's related to the WON opportunity (from contract record).  What would be the correct code to use to display the Opportunity Product (from Opportunity object) ON THE CONTRACTS related list?