My use case is that I have overridden the 'View' button with a Visualforce page which immediately redirects to either a Visualforce page or the standard detail page based on the RecordType. I would like to extend this functionality to the 'New' button so that after the record type is selected, I navigate appropriately.

However, I have been unable to find a method that generates the page for a new record. Using edit() on the standardController throws an error. Any advice?


Have you tried returning a PageReference to /003/e? That's the page that you get to create a new contact.

Try this:


<apex:page controller="NewContactController">
        <apex:commandButton action="{!NewContact}" value="New Contact"/>


public with sharing class NewContactController {
    public pageReference NewContact()
        return new PageReference ('/003/e?RecordType=<your record type ID>');

This will take you to the contact creation page whenever you click the 'New Contact' button.

If what you want is to specify a specific record type it might be doable via the queryString... would have to investigate a bit more.

  • That seems to have the same effect as pressing the button, causing a redirect loop. Additionally, we do need to specify a record type. Mar 4 '16 at 20:04
  • 1
    In order to specify a record type, all you need to do is add the following to the query string: ?RecordType=<your record type ID>
    – mkorman
    Mar 7 '16 at 17:24

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.