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
UmapenUmapen 

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

https://cs2.salesforce.com/apex/MytestPage1?id=066Q000000001ZM

 

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

 https://cs2.salesforce.com/066Q000000001ZM

Here my code:

 

Controller:


public with sharing class MytestController {

  private final Account stdAcct;

 

  public PageReference EditList(){

  //return page.MytestControllerPage2;

    PageReference editList = Page.MytestControllerPage2;

    editList.getParameters().put('id', stdAcct.id);

    editList.setRedirect(true);

    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:pageBlock>

<apex:form > <apex:pageBlock >

<apex:pageBlockButtons location="top">

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

</apex:pageBlockButtons>

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

</apex:page>

 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 -->

<h1>Congratulations</h1>

This is your new Page

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

</apex:page>

 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?