This is my data model.

Master Object : Expense

Detail Object : ExpenseChild

enter image description here

The above picture shows the page layout that I currently have.

Can someone let me know whether it is feasible to show my own ExpenseChild VF page instead of the related list ( bordered in blue ) ?.


@Tx Knolle !. I am currently following what you have mentioned.

Using Parent Object's controller + extensions, I was able to pull the child records's data.

My code (which is at a very nascent stage as of now) is as below

VF Markup

<apex:page standardController="Expense__c" extensions="test_e" >
  <!-- Begin Default Content REMOVE THIS -->
 <h1> ExpenseChild's CLText Field Content : </h1>
  <h2> {!s} </h2>


public class test_e {

public String s;
public String child_data;

public String gets()

return child_data;

    public test_e(ApexPages.StandardController controller) 

     s = String.valueOf(ApexPages.CurrentPage().getParameters().get('id'));
     List<ExpenseChild__c> child_coll = [SELECT Id,CLText__c FROM ExpenseChild__c WHERE Expense__c = :s];
     //child_data = String.ValueOf(child_coll.size());

     for(ExpenseChild__c ec : child_coll)
          if(child_data != null)
          child_data = child_data+ec.CLText__c.left(10)+'\n\n';
           child_data = ec.CLText__c.left(10);




Screenshot as of now :

enter image description here

Can you tell me is it possible to display the child records in the form of a table ?.

Tx for the help !

  • You can do this without code.
    – crmprogdev
    Feb 7, 2015 at 15:34

2 Answers 2


Technically, there is no way to achieve that exact behavior, because it is required that an embedded VF page in a page layout use a standardController for that entity. You can still get the data onto the parent VF page, though, and with some refactoring make it a bit more maintainable.

Here's an idea that you could use.

  1. Refactor the child VF page so that its entire body is in a Visualforce component.
  2. Create a VF page with the parent standardController specified.
  3. Add the component to the parent page.
  4. Embed the parent Visualforce page in the page layout.

You can use an apex:pageBlockTable to display the records in a table.

You may need to tinker around with how the component should work (e.g., processes a list of children vs. one child), but in the end you'd have a single place, the component, that would need to be maintained. Changes to it would be seen on the parent page layout and on the child's VF page.

  • Hi Knolle..I have updated my question after following your inputs..can you please take a look ?..tx
    – Varun
    Feb 7, 2015 at 15:34

Yes, you can do this. The important thing is to make certain there's an easy means of ensuring your new records will be linked to a Master Record. A good example of how to do this is in the Force.com Platform Fundamentals in the Managing Review Assessments section where there's a M-D relationship between the Job Application and the Review that references the title of the position on the Review's parent object job application record via a cross-object formula hyperlink.

  • Tx..I will go through the link you have mentioned..appreciate it :)
    – Varun
    Feb 7, 2015 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.