function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TheRealistTheRealist 

what is InLineVF page and its usage?

Hi 
after little reading i came across below blog which is explaining about inline VF page,i am looking forward to programatically experience how this works but the apex class written in this blog is not working,can someone help me out,i believe the class needs little modification and i am failing do that, help will be highly appreciated.

http://blog.jeffdouglas.com/2009/05/08/inline-visualforce-pages-with-standard-page-layouts/
Best Answer chosen by TheRealist
ManojjenaManojjena
Hi TheRealist,

InlineVF page is a page which you can add in standard detail page . 
1.Basic concept of the inline VF page is that the page should have standard controller as that particular object in which object you need to add .
2.The inline VF will not visible in edit mode .
Scenario 1.
You can use in many cases .suppose you need to display a message in detail page then you can add the vf page which will a modified message.

Scenario2 .
You can add a custom related list in one object for which alos you can add inline VF page .

Scenario3.
You can add a vf to add attachment in the record in your customised way .

Scenario4 - You can add a VF button and diaply based on some condition .

For many more option like this you can add inline VF pages .

You can add this in Account and check .
 
<apex:page standardController="Account">
  <apex:panelGroup rendered="{!IF(CONTAINS(Account.Owner.Profile.Name,'System Administrator')),TRUE,FALSE)}">
      <apex:pageMessage id="msg" escape="0" summary="Please do what u want to do" severity="warning" strength="3"/>
  </apex:panelGroup>
</apex:page>

To add the inlineVF you have to edit the layout and click on visualforce and drag and drop where ever you need to add .

User-added image

Like above picture you need to select .

Like above you can add as you need .

Let me know if it helps .

Thanks 
Manoj

All Answers

Vivek DeshmaneVivek Deshmane
Hi TheRealist,
I have modified blog code , you can try it will work now. use this page inline from account page layout , follow step as metiond  blog. please let me if this works for you and mark the best answer.
Apex Code:

public class OpportunitySearchController {

    //added an instance varaible for the standard controller
    private ApexPages.StandardController controller {get; set;}
    // the actual account
    private Account a;
    // the results from the search. do not init the results or a blank rows show up initially on page load
    public List<opportunity> searchResults {get;set;}

    // the text in the search box
    public string searchText {
        get {
            if (searchText == null) searchText = 'Acme'; // prefill the serach box for ease of use
            return searchText;
        }
        set;
    }

    public OpportunitySearchController(ApexPages.StandardController controller) {

        //initialize the stanrdard controller
        this.controller = controller;
        this.a = (Account)controller.getRecord();

    }

    // fired when the search button is clicked
    public PageReference search() {
        if (searchResults == null) {
            searchResults = new List<opportunity>(); // init the list if it is null
        } else {
            searchResults.clear(); // clear out the current results if they exist
        }
        // Note: you could have achieved the same results as above by just using:
        // searchResults = new List<categoryWrapper>();

        // use some dynamic soql to find the related opportunities by name
        String qry = 'Select o.Id, o.Name, o.StageName, o.CloseDate, o.Amount from Opportunity o Where AccountId = \''+a.id+'\' And o.Name LIKE \'%'+searchText+'%\' Order By o.Name';
        searchResults = Database.query(qry);
        return null;
    }

}
VF Page Code

<apex:page standardController="Account" extensions="OpportunitySearchController"> <style type="text/css"> body {background: #F3F3EC; padding-top: 15px} </style> <apex:form > <apex:pageBlock title="Search for Opportunities by Keyword" id="block" mode="edit"> <apex:pageMessages /> <apex:pageBlockSection > <apex:pageBlockSectionItem > <apex:outputLabel for="searchText">Keyword</apex:outputLabel> <apex:panelGroup > <apex:inputText id="searchText" value="{!searchText}"/> <apex:commandButton value="Search" action="{!search}" rerender="resultsBlock" status="status"/> </apex:panelGroup> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:actionStatus id="status" startText="Searching... please wait..."/> <apex:pageBlockSection id="resultsBlock" columns="1"> <apex:pageBlockTable value="{!searchResults}" var="o" rendered="{!NOT(ISNULL(searchResults))}"> <apex:column headerValue="Name"> <apex:outputLink value="/{!o.Id}">{!o.Name}</apex:outputLink> </apex:column> <apex:column value="{!o.StageName}"/> <apex:column value="{!o.Amount}"/> <apex:column value="{!o.CloseDate}"/> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

Best Regards,
-Vivek
ManojjenaManojjena
Hi TheRealist,

InlineVF page is a page which you can add in standard detail page . 
1.Basic concept of the inline VF page is that the page should have standard controller as that particular object in which object you need to add .
2.The inline VF will not visible in edit mode .
Scenario 1.
You can use in many cases .suppose you need to display a message in detail page then you can add the vf page which will a modified message.

Scenario2 .
You can add a custom related list in one object for which alos you can add inline VF page .

Scenario3.
You can add a vf to add attachment in the record in your customised way .

Scenario4 - You can add a VF button and diaply based on some condition .

For many more option like this you can add inline VF pages .

You can add this in Account and check .
 
<apex:page standardController="Account">
  <apex:panelGroup rendered="{!IF(CONTAINS(Account.Owner.Profile.Name,'System Administrator')),TRUE,FALSE)}">
      <apex:pageMessage id="msg" escape="0" summary="Please do what u want to do" severity="warning" strength="3"/>
  </apex:panelGroup>
</apex:page>

To add the inlineVF you have to edit the layout and click on visualforce and drag and drop where ever you need to add .

User-added image

Like above picture you need to select .

Like above you can add as you need .

Let me know if it helps .

Thanks 
Manoj
This was selected as the best answer
TheRealistTheRealist
Thanks @vivek deshmane and @ Manoj.... vivek tried your code,i have the following error on my vf page

invalid ID field: null
Error is in expression '{!search}' in component <apex:commandButton> in page inlinevfonaccount: Class.OpportunitySearchController.search: line 39, column 1
An unexpected error has occurred. Your development organization has been notified.