0

I want to embed a visualforce page inside a standard layout. Both page and extension are fine (Preview is working). Controller -

    public with sharing class ExpenseExtension{

        private final expense_report__c repo;
        public expenseExtension(ApexPages.StandardController std){
            this.repo = (expense_report__c)std.getRecord();
          }

        public list<expense_item__c> getItems(){

            return [select serial__c, Appointment__c, AppointDate__c, Mode_of_Travel__c, Kms_Travelled__c, Expense_Incurred__c from
                    expense_item__c where expense_report__c = :repo.id];
        }
}

Visualforce -

<apex:page standardController="Expense_Report__c" extensions="ExpenseExtension">
<apex:pageBlock title="Expense Items" >
   <apex:pageBlockTable value="{!items}" var="item" width="900px">
      <apex:column value="{!item.Serial__c}"/>
      <apex:column value="{!item.Appointment__c}"/>
      <apex:column value="{!item.AppointDate__c}"/>
      <apex:column value="{!item.Mode_of_Travel__c}"/>
      <apex:column value="{!item.Kms_Travelled__c}"/>
      <apex:column value="{!item.Expense_Incurred__c}"/>
   </apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

When I try dragging the page I don't see any placeholder on the standard layout. What's the reason? What I'm missing, obviously I would like to have my inline page above the Approval History list.

enter image description here

1

You need to first add a Section or Blank Space into which you will drag your VisualForce Page. You can then drag the page into either of these.

Screenshot

2
  • Hi Adrian, I have added the page section and dropped my visualforce page. Now I can only see my visualforce page and the whole standard layout has been overridden. Even after editing the page layout and removing the section is not working, I can only see the inline vf page for the whole record.
    – Jarvis
    Jan 7 '16 at 3:48
  • 1
    Did you inadvertently override the View action at some point in your experimentation? Check Create > Objects > Expense_Report__c > Buttons, Links, and Actions.
    – Adrian Larson
    Jan 7 '16 at 3:50

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.