using an inline visualforce page

An inline visualforce page is a vf page which can be embedded within a detail page of a record. Salesforce allows doing so, in the edit page layout option. A vf page would be available for embedding in the detail page layout provided page is using standard controller of that particular object. For example, in the below example a inline vf page of standard controller 'contact' would be available for embedding in contact records only.

visualforce page
<apex:page standardController="contact" extensions="inlinecontroller">
 <apex:form >
   <apex:pageBlock title="My Inline Visualforce page">
    Account Name <apex:outputField value="{!}"/><br/>
     Account Number  <apex:outputField value="{!accRec.accountnumber}"/><br/>
     Annual Revenue     <apex:outputField value="{!accRec.annualrevenue}"/>

public with sharing class inlinecontroller {
Public contact conRec{get;set;}
Public id accRecId;
Public account accRec{get;set;}
    public inlinecontroller(ApexPages.StandardController controller) {      
     accRecId = [select id,accountid from contact where id = :ApexPages.currentPage().getParameters().get('id')].accountid;
      if(accRecId != null)
         accRec = [select id,name,accountnumber,annualrevenue from account where id =:accRecId];

Related Articles


  1. I have a question: In your controller, you have this code:

    accRecId = [select id,accountid from contact where id = :ApexPages.currentPage().getParameters().get('id')].accountid;

    You can enter actual record ID's like this: accRecId = [select id from campaign where id = '701i0000000JXz5'].id;

    But what I want to know is if you can enter more than one record ID into the code I typed above. How would it be formatted? What would it look like? I'm using a standard controller and list controller and this is an extension. I need a way to filter so I only see specific results. I'd rather not use a drop down menu or picklist to filter.

  2. what are the limitations of inline visual force pages?

  3. Replies
    1. you need to pass the contact id value in ApexPages.currentPage().getParameters().get('id'). You can do this by inserting the inline vf page on Contact layout.