You need to sign in to do that
Don't have an account?
Pritika
Navigation to a standard edit page from a vf page in lightning theme
Hi,
I am a newbie to Lightning,I have created a custome vf page for Record type selection,based on Record type,It navigates to a vf page or to a standard page.This logic is working fine in classic, but in lightning,the redirection to next vf page is working but redirection to standard page is throwing error and not navigating:
Following is my code snippet:
<apex:page standardController="Account" extensions="LH_CreateNewCompany_Extsn" action="{!redirectCompany}" showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"></html>
</apex:page>
Following is method on redirection:
public class LH_CreateNewCompany_Extsn
{
public Account acc{get;set;}
ApexPages.standardController m_sc = null;
public string type{get;set;}
public string rectypeid;
public String Record_type { get; set; }
public LH_CreateNewCompany_Extsn(ApexPages.standardController sc)
{
m_sc = sc;
acc = new account();
acc = (Account)m_sc.getRecord();
acc.OwnerId = UserInfo.getUserId();
rectypeid = ApexPages.currentPage().getParameters().get('rectypeid');
acc.RecordTypeId = rectypeid;
type = apexpages.currentpage().getParameters().get('rectypeid');
}
public PageReference redirectCompany()
{
Id selectedRecordType = ApexPages.currentPage().getParameters().get('RecordType');
Id recTypeId_Tender = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Tender').getRecordTypeId();
Id recTypeId_Customer = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Customer').getRecordTypeId();
Pagereference newpage = new Pagereference ('/001/e');
newpage.getParameters().put('nooverride','1');
return newpage;
if(recTypeId_Customer == selectedRecordType ){
string str;
str=userinfo.getUiThemeDisplayed();
if(str == 'Theme4d')
{PageReference ReturnPage = new PageReference('/apex/LH_CreateNewCompany_Lightning?rectypeid='+selectedRecordType+'&type=new');
ReturnPage.setRedirect(true);
return ReturnPage;}
else{
PageReference ReturnPage = new PageReference('/apex/LH_CreateNewCompany?rectypeid='+selectedRecordType+'&type=new');
ReturnPage.setRedirect(true);
return ReturnPage;}
}else{
PageReference ret=new PageReference('/001/e'); //Not working on lightning
ret.getParameters().put('nooverride','1');
return ret;
}
return null;
}
}
I am a newbie to Lightning,I have created a custome vf page for Record type selection,based on Record type,It navigates to a vf page or to a standard page.This logic is working fine in classic, but in lightning,the redirection to next vf page is working but redirection to standard page is throwing error and not navigating:
Following is my code snippet:
<apex:page standardController="Account" extensions="LH_CreateNewCompany_Extsn" action="{!redirectCompany}" showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"></html>
</apex:page>
Following is method on redirection:
public class LH_CreateNewCompany_Extsn
{
public Account acc{get;set;}
ApexPages.standardController m_sc = null;
public string type{get;set;}
public string rectypeid;
public String Record_type { get; set; }
public LH_CreateNewCompany_Extsn(ApexPages.standardController sc)
{
m_sc = sc;
acc = new account();
acc = (Account)m_sc.getRecord();
acc.OwnerId = UserInfo.getUserId();
rectypeid = ApexPages.currentPage().getParameters().get('rectypeid');
acc.RecordTypeId = rectypeid;
type = apexpages.currentpage().getParameters().get('rectypeid');
}
public PageReference redirectCompany()
{
Id selectedRecordType = ApexPages.currentPage().getParameters().get('RecordType');
Id recTypeId_Tender = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Tender').getRecordTypeId();
Id recTypeId_Customer = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Customer').getRecordTypeId();
Pagereference newpage = new Pagereference ('/001/e');
newpage.getParameters().put('nooverride','1');
return newpage;
if(recTypeId_Customer == selectedRecordType ){
string str;
str=userinfo.getUiThemeDisplayed();
if(str == 'Theme4d')
{PageReference ReturnPage = new PageReference('/apex/LH_CreateNewCompany_Lightning?rectypeid='+selectedRecordType+'&type=new');
ReturnPage.setRedirect(true);
return ReturnPage;}
else{
PageReference ReturnPage = new PageReference('/apex/LH_CreateNewCompany?rectypeid='+selectedRecordType+'&type=new');
ReturnPage.setRedirect(true);
return ReturnPage;}
}else{
PageReference ret=new PageReference('/001/e'); //Not working on lightning
ret.getParameters().put('nooverride','1');
return ret;
}
return null;
}
}
return new PageReference('/'+Id);
It randamly throws error in lightning.However this navigation works perfectly in classic.
We are using vf page with lightning designing.
Note: in Lightning too it is random.Sometimes I receive an error sometimes I don't.
Has anyone found any solution to these navigation problem?