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

VF page from Account section(VF page)

I have a custom controller, and 2 visual force pages.

My page1 is  Inside account page layout. Page 1 has a button that post page2 

Page 2 posts inside the section of account. How do I post my page 2 to new page.


When I test with the following URL it works - page 2 is posted properly


When I test with following URL after adding to account page layout Page 2 is inside the account section

Here my code:



public with sharing class MytestController {

  private final Account stdAcct;


  public PageReference EditList(){

  //return page.MytestControllerPage2;

    PageReference editList = Page.MytestControllerPage2;



    return editList;



  public MytestController(ApexPages.StandardController stdcontroller){

    this.stdAcct =  [select id, name, BillingCity from Account   where id = :ApexPages.currentPage().getParameters().get('id')];






Page1 - added to account page layout 


<apex:page standardcontroller="Account" extensions="MytestController" sidebar="false" showheader="false" standardStylesheets="true">

<apex:pageBlock ><b>Account Name: </b><apex:outputText value="{!account.Name}" rendered="true"/>

<b> City: </b><apex:outputText value="{!account.BillingCity}" rendered="true"/>

<b> Market Name: </b><apex:outputText value="{!account.Market_Name__r.Name}" rendered="true"/>


<apex:form > <apex:pageBlock >

<apex:pageBlockButtons location="top">

<apex:commandButton action="{!EditList}" value="Post another page" status="status" />


</apex:pageBlock> </apex:form>


 Page2 - post from with button click on page1

<apex:page standardcontroller="Account" extensions="MytestController" sidebar="true" showHeader="true" standardStylesheets="true">

<!-- Begin Default Content REMOVE THIS -->


This is your new Page

<!-- End Default Content REMOVE THIS -->


 I tried using commandLink instead of Commandbutton and used target="_blank"  But the page does not display header and sidebar. 

NOTE: My page 1 has showHeader="false" Page 2 has showHeader="true"


I turned off DevelpmentMode in use setting.


Any suggestions?