0

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

3
  • 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, 2016 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, 2016 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, 2016 at 18:43

1 Answer 1

1

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!!! -->
</apex:page>
4
  • 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, 2016 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, 2016 at 19:24
  • Pretty nifty. :)
    – Adrian Larson
    Sep 7, 2016 at 19:24
  • Thanks again Derek and Adrian too. I like the fancy buttons
    – Ohmicron
    Sep 7, 2016 at 20:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .