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
@login.ax974@login.ax974 

Inline VF page on pagelayout of an object is blank

Hello everyone,

 

I have overriden standard opportunity Edit feature. In order to provide inline edit i have to also override the view. The VF page used for the view is very simple and is as below. But now there is a problem. Another VF page which was embeded earlier as part of the opportunity page layout now comes as blank with this overriden view. I guess it is because of the detail tag - how can now i adjust that VF page with this functionality?

 

<apex:page standardcontroller="Opportunity">
    <apex:form >
        <apex:detail subject="{!opportunity.Id}" relatedlist="true" inlineedit="true"/>    </apex:form>
</apex:page>
Best Answer chosen by Admin (Salesforce Developers) 
asish1989asish1989

Hi

  Try to use this... 

I have designed two pages one inline visualforce page named "OveriddingPriceBook2buttom" another  is "TestOnOpportunity"

which is ovridden with view button.. This is my code you can follow 

In line visualforce page and controller 
<apex:page standardController="Opportunity" extensions="PriceBookDemoController" >
     {!OppName}
     <apex:sectionHeader title="Price Book" subtitle="{!OppName}"/>
       <apex:form >
         <apex:pageBlock title="Choose Price Book for:">
          <apex:pageBlockButtons location="bottom">
              <apex:commandButton value="Save" action="{!save}"/>
              <apex:commandButton value="Cancel" action="{!cancel}"/>
          </apex:pageBlockButtons>
         <apex:panelGrid columns="3">
             <apex:outputText value=" Price Book"/>&nbsp;
                 <apex:selectList id="status2" size="1" multiselect="false" >
            <apex:selectOptions value="{!SelectBranchOptions}"/>
        </apex:selectList>
       </apex:panelGrid>
  </apex:pageBlock>
    </apex:form>
</apex:page>

My controller is 
public class PriceBookDemoController {
public String OppName{set;get;}
Id OpportunityId;
    public PriceBookDemoController(ApexPages.StandardController controller) {
      OpportunityId = apexPages.currentPage().getParameters().get('id');
      Opportunity Opp = [select Id,Name from Opportunity where id =: OpportunityId];
      OppName = Opp.Name;
    }
     
  public List<SelectOption> getSelectBranchOptions() {
  List<SelectOption> options = new List<SelectOption>();
  for(pricebook2 pb:[select id,name from pricebook2 where isactive = true]) {
    options.add(new SelectOption(pb.id,pb.name));
  }
  return options;
}
}

 My page which is overidden with view button is..

<apex:page standardcontroller="Opportunity">
    
        <apex:detail  relatedlist="true" inlineedit="true" >
        
        
    
            <apex:include pageName="OveriddingPriceBook2buttom" rendered="false"/>
         </apex:detail >
</apex:page>

 DId this post answers your questions if so please mark it solved so that others get benifited 

 

Thanks

All Answers

asish1989asish1989

Hi

  Try to use this... 

I have designed two pages one inline visualforce page named "OveriddingPriceBook2buttom" another  is "TestOnOpportunity"

which is ovridden with view button.. This is my code you can follow 

In line visualforce page and controller 
<apex:page standardController="Opportunity" extensions="PriceBookDemoController" >
     {!OppName}
     <apex:sectionHeader title="Price Book" subtitle="{!OppName}"/>
       <apex:form >
         <apex:pageBlock title="Choose Price Book for:">
          <apex:pageBlockButtons location="bottom">
              <apex:commandButton value="Save" action="{!save}"/>
              <apex:commandButton value="Cancel" action="{!cancel}"/>
          </apex:pageBlockButtons>
         <apex:panelGrid columns="3">
             <apex:outputText value=" Price Book"/>&nbsp;
                 <apex:selectList id="status2" size="1" multiselect="false" >
            <apex:selectOptions value="{!SelectBranchOptions}"/>
        </apex:selectList>
       </apex:panelGrid>
  </apex:pageBlock>
    </apex:form>
</apex:page>

My controller is 
public class PriceBookDemoController {
public String OppName{set;get;}
Id OpportunityId;
    public PriceBookDemoController(ApexPages.StandardController controller) {
      OpportunityId = apexPages.currentPage().getParameters().get('id');
      Opportunity Opp = [select Id,Name from Opportunity where id =: OpportunityId];
      OppName = Opp.Name;
    }
     
  public List<SelectOption> getSelectBranchOptions() {
  List<SelectOption> options = new List<SelectOption>();
  for(pricebook2 pb:[select id,name from pricebook2 where isactive = true]) {
    options.add(new SelectOption(pb.id,pb.name));
  }
  return options;
}
}

 My page which is overidden with view button is..

<apex:page standardcontroller="Opportunity">
    
        <apex:detail  relatedlist="true" inlineedit="true" >
        
        
    
            <apex:include pageName="OveriddingPriceBook2buttom" rendered="false"/>
         </apex:detail >
</apex:page>

 DId this post answers your questions if so please mark it solved so that others get benifited 

 

Thanks

This was selected as the best answer
ABHIKSARKARABHIKSARKAR

Just one point apart from the solution mentioned above.

The inline VF populates in the original page, however it also creates a related list at the bottom of the VF page with the content of the inline VF page. 

I believe that needs to be rendered as false. 

@login.ax974@login.ax974

Hi Asish,

 

 Thanks for the reply. I tried page include earlier but it won't help. This new page which i want to include is used to show the opportunity owner only - so this should come as part of a field on the top section of the opportunity layout next to opportunity name. With page include i get a section at the bottom of the opportunity in form of a related list. Is there a way to do this?

 

Thanks.

ABHIKSARKARABHIKSARKAR

Hi,

 

As mentioned , I tried it out in my dev org.

 

With Inlcude tag , it will add the VF page both as an inline VF page (if it is already added in your standard page layout) & also add it as a related list. 

 

To remove it from the related list , just make it include tag rendered as false. So it should be populated only as an inline VF page now. 

 

Please let me know if this helps solve your problem. 

@login.ax974@login.ax974

Thanks it worked.

Regards.

ABHIKSARKARABHIKSARKAR

Glad to know that it worked for you. 

Sagnik Raha 39Sagnik Raha 39
Sorry for reopening this thread after such a long time. I'm facing a similar situation now and even after using include tag it isn't working.
I've a VF page where I'm using apex detail tag. This page is overriding the view button.Now, I want to show some data from another object in view page. For this, I created another VF page with extension controller. I created a new section on layout and embedded this page on the newly created section.Although,it's showing the data correctly on preview but not on the actual page!
I've removed the override and on standard layout then it's working fine.
Is there some problem around the apex:detail tag used?