We want a custom visual force page to be used when a user clicks new on a custom object. I can seem to easily replace the edit page but how do I get salesforce to use a visual force page for the default new record button

  • Isn't it nearly identical to overriding the edit button? Simply going to the Buttons, Actions, and Links section of your custom object, finding the New button, and clicking edit should allow you to choose a Visualforce page to use as an override. – Derek F Sep 7 '16 at 18:21
  • Yeah dumb question. I'm going to delete it but thanks a lot Derek. I was making this a little more complicated than it needed to be – Ohmicron Sep 7 '16 at 18:25
  • 2
    I wouldn't delete this unless you can find a duplicate question (I did a cursory search, but didn't find anything). Yes, it's a simple question, and probably covered by existing documentation, but getting the information exposed in more places makes it easier for others to solve their problems as well. I'll start writing an answer based on my comments. – Derek F Sep 7 '16 at 18:43

Overriding the New button for a custom object ends up being a pretty similar process to overriding the Edit button.

There are two pieces of documentation that have relevant information.

The gist of the first link is that to override the New button, you go to

Setup => Create => Objects => Click the name of your Custom Object

From there, click the Buttons, Links, and Actions link at the top of the page (or just scroll down). Then, click the Edit action link next to New. This brings you to the page where you can override the button with a Visualforce page.

Don't forget that you can only use Visualforce pages that use the standard controller for your custom object. If your object is MyCustomObject__c, you'd need to have the following in your Visualforce page at a minimum

<apex:page standardController="MyCustomObject__c">
    <!-- Super interesting things here!!! -->
| improve this answer | |
  • I tweaked your post to use <kbd> for buttons. Obviously feel free to change it back if you don't like it! – Adrian Larson Sep 7 '16 at 19:19
  • 1
    @AdrianLarson I like it! When I first loaded the edit, I wondered what manner of wizardry was at play here. I've never used that tag before. – Derek F Sep 7 '16 at 19:24
  • Pretty nifty. :) – Adrian Larson Sep 7 '16 at 19:24
  • Thanks again Derek and Adrian too. I like the fancy buttons – Ohmicron Sep 7 '16 at 20: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.