I have multiple Record Types for contact. when the user clicks on 'New Contact' button for a specific record type it should redirect to a custom edit vf page. All the remaining record types should use the standard layouts as per the assignment.

Here are my questions:

  1. Do I need to override the New button with the vf page? If I'm doing this overriding of button the vf page is showing to all record types irrespectively.
  2. Is something that I can handle in the redirect method without overriding the new method?
  3. Can we do it by querying the recordtype sobject instead of hardcoding?

Here is my code:


<apex:page standardcontroller="Contact" extensions="CustomEditPageController" sidebar="false" tabstyle="Contact" action="{!redirect}">


 public pagereference Redirect()
     If(ApexPages.currentPage().getParameters().get('RecordType') != '016s00000005g78j')
           String hostname = ApexPages.currentPage().getHeaders().get('Host'); 
           String Contact = 'https://'+hostname+'/'+'/003/e?nooverride=1';
           pagereference pageref = new pagereference(Contact);
           return pageref;
     return null;  
  • take a look at this for the hint of a solution without a controller. The save_new_url param can be to a VF page with a page action method that does the redirect for you. Note that this is URL hacking and hence will not work in Lightning
    – cropredy
    Jun 8, 2016 at 6:52

2 Answers 2


For your issue#1, when you override the New Action with the custom VF page there is a checkbox "Skip recordtype selection page" there that controls whether the default recordtype selection should be displayed or not. You need to check it. Then as Shailesh mentioned, in your custom VF page you will have to present list of recordtypes available to the user and based on recordtype selected route the user to either custom edit page or the standard page layout. Hope this helps.


Instead, create a VF page that imitates the record type selection page. A pick list and two buttons. When someone selects the pick list value and press continue, check the record type name in the controller and accordingly redirect the user to either a VF page or standard page.

Please let me know if you need any more clarification on this.


You must log in to answer this question.

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