+ Start a Discussion
Raghu RamanujamRaghu Ramanujam 

Page Redirection in Lightning not working(Based on Record Type)

Hi All,

We have 3 record types for Lead Object.
I have to display 3 different page layouts depending on the RecordType ( Create New Lead)
It works fine in Classic, but its not working in Lightning ..

Apex Class:
public classLeadNew{
    public LeadNew(ApexPages.StandardController controller) {
        this.controller = controller;
 public PageReference getRedir() {
        PageReference newPage;
        if (ApexPages.currentPage().getParameters().get('RecordType') == '012w00000003BUmAAM') {
            newPage = Page.HCONE_LeadNew;
            System.debug('UserName  ' + Userinfo.getName());
            return newPage.setRedirect(true);                                        
        } else if  (ApexPages.currentPage().getParameters().get('RecordType') == '012200000000Ed8AAE' ){
            newPage = Page.HCTWO_LeadNew;
            return newPage.setRedirect(true);
            return null;

       private final ApexPages.StandardController controller;

VF Page:
<apex:page standardController="Lead" showHeader="true" sidebar="true" tabStyle="Lead" extensions="LeadNew" action="{!nullValue(redir.url, urlFor($Action.Lead.New, null, null, true))}"> </apex:page>
Whats wrong in the above code ?/