function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
admin sureshadmin suresh 

How to Assign different pages based on recordtype?

I have a scenorio,, while creating a new contact page, if i select a  RecordType1 it should redirect to visualforce page and if i select RecordType2 it should go to standard contact page?

Please help me
SonamSonam (Salesforce Developers) 
This should help:
https://help.salesforce.com/HTViewSolution?id=000044598&language=en_US
admin sureshadmin suresh
Hi Sonam

I Tried like this but is NOT WORKING ... Please help me

VF Page------
<apex:page standardController="Contact" extensions="ContactRecordTypePage" action="{!redirectToPage}">
</apex:page>

Controller class----------
public class ContactRecordTypePage
{
   private final ApexPages.StandardController controller;
    public ContactRecordTypePage(apexpages.standardcontroller controller)
    {
       this.controller = controller;
    
    } 
    public PageReference redirectToPage() {
        ID id = ApexPages.currentPage().getParameters().get('RecordTypeID');
        system.debug(id);
       if (id == '01290000001AnHy')
       {
           PageReference p = new PageReference('003/e?retURL=%2F003%2Fo&RecordType=01290000001AnHy&ent=Contact');
           p.setRedirect(true);
           return p;
        }
             //return Page.RehireBadgeOnly.setRedirect(true);
      else
      {
        // return new PageReference('/003/e?retURL=%2F003%2Fo');
         
           PageReference p1 = new PageReference('003/e?retURL=%2F003%2Fo&RecordType=01290000001AnII&ent=Contact');
           p1.setRedirect(true);
           return p1;
        
        //return null;
       }
       return null;
    }

}