+ Start a Discussion
emandra_kfemandra_kf 

Child to Parent relational query in a "New" Visualforce page

I am attempting to access parent data fields from a child object in a Visualforce page used to create new records in the child object.

 

I have a similar detail page for viewing records in the child object, and on that page I can simply access parent data with the apex component:

<apex:outputfield value="{!child_object__c.parent_object__r.fieldname}".

 

However, with the "new" page, the same approach just comes back null. Do I need to create a controler extension instead? I'm lost and not sure what the right approach might be.