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
InterstateAdminInterstateAdmin 

Referencing a related List field

First...I couldn't be more green at this, so please forgive me.  I've researched everywhere I can, and have tried everything I've found and it's still not working.

I've got an object - Programs (Programs__c) with a related list called Program Overview (Program_Overview__c).  On the Program Overview there are several fields (example:  Inventory_Excellence__c).  I'd like to bring that field up to my VF page.

I've tried apex:inputfield, apex:outputfield, apex:inputtext....I'm at a loss.
I've put it between <apex:form> and tried it without.


How do I bring a field up from my related list?  Thank you!
kevin lamkevin lam
In what way do you want to display that field? In a table?
Ramu_SFDCRamu_SFDC
As Program_Overview__c is a related list(Child Object) to Programs__c, each of the Programs__c would have multiple Program_Overview__c records. When you want to populate a field value from child records on the parent record field, you should make sure that you are passing only one value out of a set of records somehow.

Follow the below example

http://salesforce.stackexchange.com/questions/33132/accessing-child-records-in-visualforce
InterstateAdminInterstateAdmin
@Kevin Iam - My goal is to make a new "Print Screen".  I want to take the child objects related to my ParentObject and display them.

So, I want a few fields from the Parent (Programs__c), a few fields from one child (Program_Overview__c), a few fields from another child (Issues__c), etc.

Ideally, the Program Overview fields would display in three columns:

Field Name    Status   Notes (i.e. field contents)
Field Name    Status   Notes
and so on...

I figured if I could get the first one done, I could figure out the rest - but I've been stuck on the first one for hours (again, I have no idea what I'm doing!).  

Thanks!
kevin lamkevin lam
You can try something like this (assume the child relationship name of Program_Overview__c is Program_Overviews__r):
<apex:relatedList list="Program_Overviews__r">
  <apex:facet name="body">
    <apex:pageBlockTable value="{!Programs__c.Program_Overviews__r}" var="po">
      <apex:column value="{!po.Name}"/>
      <apex:column value="{!po.Status__c}"/>
    </apex:pageBlockTable>
  </apex:facet>
</apex:relatedList>