I have created a custom object as customlineItem and a created a visual force page based on the custom object by calling their fields.Now i would like this visual force page to get reflected as a related list or as a page for the standard object 'Product2' . can any one help me out or any suggestion please.

<apex:page standardController=" customlineItem __c"  sidebar="false" showHeader="false">
 <apex:form >
  <apex:pageBlock >
<apex:pageBlockButtons location="top">
  <apex:commandButton value="SAVE" action="{!SAVE}"/>
  <apex:commandButton value="SAVE&MORE" action="{!SAVE}"/>
  <apex:commandButton value="CANCEL" action="{!CANCEL}"/>
<apex:pageblockSection title="Schedule"> 
 <apex:inputField value="{! customlineItem __c.ProductPartNumbers__c}" label="Product"/>  
  <apex:inputField value="{! customlineItem_c.PricingRequestsQuarterNos__c}" label="Quarter"/> 
  <apex:inputField value="{! customlineItem __c.Quantity__c}"/> 
  <apex:inputField value="{! customlineItem __c.Price__c}"/>
  • How is customLineItem__c related to Product2 ? Is there a lookup relationship to Product2? Your page isn't really a related list; in fact it doesn't display as a list at all since there is no apex:pageBlocktable, apex:datatable, or apex:repeat that iterates over a list object on the controller
    – cropredy
    Commented Nov 8, 2014 at 2:47

1 Answer 1


There are a few ways to do this but none are perfect from a UI perspective:

  1. You can create the entire VF page yourself, which means creating your own related lists and apex to fetch related records. This is definitely the most labor intensive, but gives you the most UI control. It does however, remove control from admins over the layout, which would then need to be updated in VF. This is a huge drawback of this approach.
  2. You can embed your VF page inside of the record detail on the page layout. You can make it look like a related list but it won't actually fall below the detail section. This solution means you have to have buttons and actions that aren't really in the right place in the UI. You also have the issue that VF components in the record detail must have a fixed height because they're in an iFrame.
  3. The last option is to use the apex:detail visualforce component, which gives you the entire page layout, and add your "related list" at the bottom of the page after the apex:detail component. In this scenario, admins still have control over the entire page layout, except your custom related list. The downfall is that your custom UI is at the very bottom of the related list elements.
  • :Thanks for your reply.i have created a vf page ,the code is above.where can i use this apex detail .can i use vf page in multi record layout.Is it possible.if yes how can i go ahead.any sugestions.
    – nikkey
    Commented Nov 7, 2014 at 18:00
  • 1
    Greenstork - a variation of #3 is apex:detail with relatedList="false" - this gives you control over the order of relatedLists as you can insert additional apex:relatedList components. Downsides are: You lose the relatedList mini-links at top of detail page and some relatedLists aren't supported by apex:relatedList such as field histories or Notes and Attachments when using Google Docs feature.
    – cropredy
    Commented Nov 8, 2014 at 2:42

You must log in to answer this question.

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