+ Start a Discussion
meyerdmeyerd 

apex:relatedList list="Partners"

I am trying to display the Partners related list

Code:
<apex:page standardController="Opportunity">
<apex:outputText value="{!Opportunity.Name}"/>

<!--<apex:relatedList list="OpenActivities"/>-->
<apex:relatedList list="Partners"/>
</apex:page>

 
I get a Visual Force error:
'Partners' is not a valid child relationship name for entity Opportunity.

Under Opportunity child Relationship I see the relationship name is 'Partners'









Best Answer chosen by Admin (Salesforce Developers) 
Ron HessRon Hess
Here is an example of how to fetch this relationship data, not sure why the name didn't work.

Code:
<apex:page standardController="Opportunity">
<apex:outputText value="{!Opportunity.Name}"/>

<apex:pageBlock>
<apex:pageblockList value="{!Opportunity.OpportunityPartnersFrom}" var="s">
<apex:column>{!s.role}</apex:column>
<apex:column>{!s.opportunity.name} </apex:column>
<apex:column>{!s.accountto.name} </apex:column>
</apex:pageblockList></apex:pageBlock>

</apex:page>

 

All Answers

stpetecrmstpetecrm

Try something like this ... I had a simillar issue this afternoon...

<apex:relatedList list="Partners__r"/>

meyerdmeyerd
Thanks for the suggestion.

It gives the same not valid message

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


OpenActivities works straight away but so far not Partners.



Ron HessRon Hess
Here is an example of how to fetch this relationship data, not sure why the name didn't work.

Code:
<apex:page standardController="Opportunity">
<apex:outputText value="{!Opportunity.Name}"/>

<apex:pageBlock>
<apex:pageblockList value="{!Opportunity.OpportunityPartnersFrom}" var="s">
<apex:column>{!s.role}</apex:column>
<apex:column>{!s.opportunity.name} </apex:column>
<apex:column>{!s.accountto.name} </apex:column>
</apex:pageblockList></apex:pageBlock>

</apex:page>

 

This was selected as the best answer
meyerdmeyerd
Thanks Ron.
mworldmworld
Also, if you have Apex Explorer you can look at each object and see all of its relationships. This is very handy when hand creating related lists.
GuillermoGuillermo

Hi Ron... I've tried out your solution and it throws...

 

Error: Component <apex:pageblocklist> has been deprecated and cannot be used in this page. Use component <apex:pageBlockTable

 

... is there any 'work around'  for this available ATM?

 

Thanks

CTU007CTU007

I simply used

 

 

<apex:tab label="Partners" name="Partners" id="tabpartners"> <apex:relatedList subject="{!opportunity}" list="OpportunityPartnersFrom" /> </apex:tab>

 

 and it works

 

 

CEPCEP

BTW, for the Account standard controller, use the following to list the Account Partners...

 

<apex:relatedList list="AccountPartnersFrom" />