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

Visualforce redirection to a Standard salesforce page



I have a simple Visualforce page that has two <apex:commandbutton> actions.


one button redirects the user to another Visualforce page which works fine.

the other button I want to redirect to the standard object contract page to create a new contract record. I can't seem to get the code right to make this bit work. any ideas?


Thanks in advance

<apex:page standardController="Contract" extensions="ExtNewContract">
<apex:form >
<apex:pageBlock title="New Contract Selection" mode="edit">
             <apex:pageBlockButtons >
                <apex:commandButton action="{!Cancel}" value="Cancel"/>

  <apex:pageBlockSection title="Contract Details" columns="2">
        <apex:CommandButton action="{!NewImplementation}" value="New Implementation" />
        <apex:CommandButton action="{!Newhistoric}" value="New Historic contract" />



public class ExtNewContract {

public ExtNewContract(ApexPages.StandardController controller) {

public PageReference NewHistoric() {
        PageReference secondPage = Page.Historic_contract;
        return secondPage; 

public PageReference NewImplementation() {
        PageReference secondPage = new PageReference ('/800/e');
        return secondPage; 



Best Answer chosen by Admin (Salesforce Developers) 

Edwards is most likely correct. Try adding "?nooverride=1" to the URL so that no override happens.

All Answers


Your code works fine in my dev org - what happens when you click the button?


Hi - when I click the 'New Implementation' button it just returns to the visualforce page.  when I click the 'Historic contract' button this correctly redirects to a Visualforce page.


on reflection I'm wondering whether this a circular reference issue.


The visualforce page giving the option for either a New implementation or a Historic one is a replacement for 'New" button on the Contract object.


Is it possible that the New implementation button is therefore just opening up itself??




Edwards is most likely correct. Try adding "?nooverride=1" to the URL so that no override happens.

This was selected as the best answer