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
cnno_devcnno_dev 

parent-child relationship visualforce __r

Hi, I have a parent-child relationship between  cnno__SFDC_Purchase_Order__c (parent) and cnno__Cnno_Purchase_Requisition__c. And I want to used the standardController to displays its contents. This is my code:

 

<apex:page standardController="cnno__SFDC_Purchase_Order__c" >

<apex:pageBlock title="PO Number {!cnno__sFDC_Purchase_Order__c.name}">
Usted está viendo la PO {!cnno__sFDC_Purchase_Order__c.name}.
</apex:pageBlock>
<apex:pageBlock title="Purchase Requisitions">
    <apex:pageBlockTable value="{!cnno__sFDC_Purchase_Order__c.Reqs__r}" var="pr">
    <apex:column value="{!pr.Name}"/>
    </apex:pageBlockTable>
</apex:pageBlock>
<apex:detail/>

 

 

I've edited the lookup relationship in the object  cnno__sFDC_Purchase_Order__c, and I put "Reqs" in the "Related List Label" field.

I guess the code is as I put above, but it's NOT working. I've also tried with cnno__sFDC_Purchase_Order__c.cnno__Reqs__r but it didn't work neither.

 

Thanks in advance!

jwetzlerjwetzler

Is the related list on your page layout?  It needs to be in order for your page to find the relationship.

 

This limitation no longer exists in the upcoming Summer '09 release.

cnno_devcnno_dev

Yes, it's in the page layout. Is there any easy way to see the methods of the standard controler? I've read something about about using describeSObject(), but I didn't find yet an easy way to invoke it.

 

Thanks again, I'll wait for your comments!

cnno_devcnno_dev

I found the problem...

I had to use the "Child Relationship Name" and not the "Related List Label".

This name is "R00N30000001NaB4EAK", which is weird...and I found it using the "Apex Explorer"

the final code is like this:

<apex:page standardController="cnno__SFDC_Purchase_Order__c" >

<apex:pageBlock title="PO Number {!cnno__SFDC_Purchase_Order__c.name}">
Usted está viendo la PO {!cnno__SFDC_Purchase_Order__c.name}.
</apex:pageBlock>
<apex:pageBlock title="Purchase Requisitions">
    <apex:pageBlockTable value="{!cnno__SFDC_Purchase_Order__c.R00N30000001NaB4EAK__r}" var="pr">
        <apex:column value="{!pr.Name}"/>
    </apex:pageBlockTable>
</apex:pageBlock>
<apex:detail />

 
</apex:page>

 

 

If anybody can explain me WHY this relationship has such a strange name... it will be helpful!

thanks

SuperfellSuperfell
It has a strange name because you haven't yet given it a name (you can set the relationship name using the custom field edit page)