+ 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:
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}">

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');
       if (id == '01290000001AnHy')
           PageReference p = new PageReference('003/e?retURL=%2F003%2Fo&RecordType=01290000001AnHy&ent=Contact');
           return p;
             //return Page.RehireBadgeOnly.setRedirect(true);
        // return new PageReference('/003/e?retURL=%2F003%2Fo');
           PageReference p1 = new PageReference('003/e?retURL=%2F003%2Fo&RecordType=01290000001AnII&ent=Contact');
           return p1;
        //return null;
       return null;