You need to sign in to do that
Don't have an account?
vikas Bhardwaj 21
navigate to standard lightning record create page from apex class
I have a requirement where the user who are in salesforce classic would navigate to custom visualforce page and other users who are in lightning experience would navigate to standard Opportunity record create page from Opportunity related list on Account. Issue is that Account Name is not getting populated on the popup of standard New Opportunity record create page.
Below is the code snippet of the Apex class.
public with sharing class CPQ_OppEditHandlerVFC{
Id oppId;
public static string getRecordTypeId;
Opportunity oppAccId {get;set;}
id AccountId;
string RecTypId;// GLM-58
String USOppRecType = Label.US_Opportunity; // GLM -58
public CPQ_OppEditHandlerVFC(ApexPages.StandardController controller) {
oppId = controller.getId();
oppAccId = (Opportunity)controller.getRecord();
AccountId =ApexPages.currentPage().getParameters().get('accid');
RecTypId = ApexPages.currentPage().getParameters().get('RecordType');
userTheme = UserInfo.getUiThemeDisplayed(); // GLM-58
}
public pageReference redirect() {
if(userTheme == 'Theme4d'){
ReturnPage = new PageReference('/006/e?ent=Opportunity&RecordType='+RecordTypeId+'&accid='+AccountId+'&nooverride=1');
}else{ // End - GLM-58
ReturnPage = new PageReference('/apex/Custom_OpportunityEditPage?retURL=%2F006%2Fo&RecordType='+RecordTypeId+'&accid='+AccountId+'&ent=Opportunity&save_new=1&sfdc.override=1');
} // GLM-58
}
}
Below is the code snippet of the Apex class.
public with sharing class CPQ_OppEditHandlerVFC{
Id oppId;
public static string getRecordTypeId;
Opportunity oppAccId {get;set;}
id AccountId;
string RecTypId;// GLM-58
String USOppRecType = Label.US_Opportunity; // GLM -58
public CPQ_OppEditHandlerVFC(ApexPages.StandardController controller) {
oppId = controller.getId();
oppAccId = (Opportunity)controller.getRecord();
AccountId =ApexPages.currentPage().getParameters().get('accid');
RecTypId = ApexPages.currentPage().getParameters().get('RecordType');
userTheme = UserInfo.getUiThemeDisplayed(); // GLM-58
}
public pageReference redirect() {
if(userTheme == 'Theme4d'){
ReturnPage = new PageReference('/006/e?ent=Opportunity&RecordType='+RecordTypeId+'&accid='+AccountId+'&nooverride=1');
}else{ // End - GLM-58
ReturnPage = new PageReference('/apex/Custom_OpportunityEditPage?retURL=%2F006%2Fo&RecordType='+RecordTypeId+'&accid='+AccountId+'&ent=Opportunity&save_new=1&sfdc.override=1');
} // GLM-58
}
}