1

We would like to have a single visualforce page displays both the parent detail and child detail together. The idea here is to prevent the user from having to traverse from the child to the parent to see the record details.

Know we could have a single detail component which would display the child record using the standard controller. ( we could write custom apex controller to retrieve the parent record fields and display this on the visualforce page ) but it is possible to have two detail components on a single page for both the parent and child. In our example the parent record is very complex and subject to change so we do not wish to attempt to custom code this layout via visualforce and would like to leverage the detail component.

the code would looks something like this:

<apex:page standardController="AccountChild">
   <apex:detail subject="{!accountChild.Id}" relatedList="false" />
   <apex:detail subject="{!account.Id}" relatedList="false" /> 
</apex:page>

But I do not think this is possible as a detail component must be attached to a singular standardController object..

2
  • 2
    It's much more clear to say a record and its parent, rather than a record and its child. The former is a one-to-one relationship once you know the child, while the latter one-to-many. Also, the subject should be an Id, not the record's Name. It's a little surprising you believe the <apex:detail> is bound in any way to the standardController considering you know about the subject attribute, but maybe this misunderstanding has something to do with it.
    – Adrian Larson
    Commented Jan 3, 2019 at 16:34
  • Thanks Adrian, let me try passing the parentId for the subject and see if this works. Commented Jan 3, 2019 at 16:55

1 Answer 1

0

You need to use the Id of a record to set it as the subject, not its name.

<apex:page standardController="Account">
    <!-- this detail shows the record you are viwing -->
    <apex:detail relatedList="false" />

    <!-- this detail shows the record parent -->
    <apex:detail subject="{!Account.ParentId}" relatedList="false" />
</apex:page>
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .