+ Start a Discussion
buggs sfdcbuggs sfdc 

Need to show Accounts related records on inline visual force page

Hi Experts,

On Account Page i wants to embed a new inline visual force page,which needs to show 2 custom objects ((entity__c,features__c) information(i mean need to show few columns from each table) on that inline visual force page.

for example:

Account1 record
          ||
          ||
          ||
 (entity__c,features__c) object columns(on Inline Visual Force Page)

Please help me out with any similar code if anyone had.

Thanks In Advance!
Muzammil BajariaMuzammil Bajaria
You want to show the the VF page on account details page? What do you mean by account related records? Can you please be more specific.
vikas chandvikas chand
<apex:page standardController="Account" extensions="ShowRelatedContact">
    <apex:form >
       <apex:pageBlock >
         <apex:pageBlockSection >
            <apex:pageBlockTable value="{!conLst}" var="con">
              <apex:column value="{!con.name}"/>
              <apex:column value="{!con.Email}"/>
              <apex:column value="{!con.Phone}"/>            
            </apex:pageblockTable>
         </apex:pageBlockSection>
       </apex:pageBlock>
    </apex:form>
</apex:page>
Here is VF Page
 
public with sharing class ShowRelatedContact {
    public list<contact> conLst{get;set;}
    
    public ShowRelatedContact(ApexPages.StandardController controller) {
            conlst = new list<contact>();
            
            conlst = [select id, name, email, phone from contact WHERE AccountId = :ApexPages.currentPage().getParameters().get('id')];
    }

}
Change the standardController only and add or remove column Value for you related objects
This the Extention Controller 

Hope This is relevant to your Hope

Mark best Answer if it fullfill your requirement

Thanks
Vikas
buggs sfdcbuggs sfdc
Hi Vikas,

Thanks thats working as expected,but i can be able to diplay only one custom object record details ,even i wants to display another object details on the same visualforce page,please help me out to resolve it.

here Account is a junction object.
         ||                      ||
         ||                      ||
object 1(fields)        object2 (fields)

now we are able to diplay on object1 field details,i also wants to show object2 fields on the same page,please have a look!