I already have in my Visualforce page the following:

<apex:page Controller="CandidateController" >

if I add to this: <apex:page standardController="Candidate__c" Controller="CandidateController" getting this error:

Error Error: A custom and standard controller cannot be referenced in the same page.

How do you wire-up the custom Visualforce page to a default button? what I meant is that if you click on the New or New Candidate as shown in the below screen shots it gives me the standard page layout but instead I want to override to the Visualforce page.

enter image description here

enter image description here


There are two steps to override standard action with custom visualforce page.

  1. Create a new visualforce page by defining that object as standard controller as shown below

    <apex:page standardcontroller="Candidate__c"></apex:page>

  2. Override the standard new action of that object.

Go to detail page of your object and look for button related list as shown below

enter image description here

click on edit against New Label and on the next screen visualforce which you have created in step 1.

enter image description here

  • Thanks for the help, please see my updated question getting error – Nick Kahn Oct 29 '15 at 19:52
  • 1
    that is correct you can't use both at the same time. Make it as follows :<apex:page standardController="Candidate__c" extensions="CandidateController" – Himanshu Oct 29 '15 at 19:53
  • now getting this error Error: Unsupported attribute extension in <apex:page> in Candidate at line 1 column 79 – Nick Kahn Oct 29 '15 at 19:56
  • it is extensions not extension :) – Himanshu Oct 29 '15 at 19:57

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.