You need to sign in to do that
Don't have an account?
m k18
can some one help how to convert apex to lightning exactly this page used in visualforce we need to convert to lightning can some one help please
Public class ProspectContactCntrl
{
Public List<SelectOption> recTypeLst {set;get;}
Public List<RecordType> recLst {set;get;}
public string selRecordType {set;get;}
public String contactId {set;get;}
public String leadId {set;get;}
public String contactName {set;get;}
public ProspectContactCntrl(ApexPages.StandardController stdController) {
recTypeLst = new List<SelectOption>();
recLst = new List<RecordType>();
recTypeLst.add(new SelectOption('','---Select---'));
List<RecordTypeInfo> infos = Prospect__c.sobjectType.getDescribe().getRecordTypeInfos();
set<id> recTypeIdLst = new Set<Id>();
// List<RecordType> recLst = [select id,name from RecordType where sobjectType = 'Prospect__c' and isActive = true];
for(RecordTypeInfo rec : infos)
{
if(rec.isAvailable() && !rec.isMaster()){
recTypeLst.add(new SelectOption(rec.getRecordTypeId(),rec.getName()));
recTypeIdLst.add(rec.getRecordTypeId());
}
}
recLst = [select id,name,Description from RecordType where id=:recTypeIdLst and sobjectType = 'Prospect__c' and isActive = true];
leadId = System.currentPageReference().getParameters().get('ldId');
contactId = System.currentPageReference().getParameters().get('conId');
if(contactId != null)
{
Contact con = [select id,name from contact where id=:contactId];
contactName= con.name;
}
}
{
Public List<SelectOption> recTypeLst {set;get;}
Public List<RecordType> recLst {set;get;}
public string selRecordType {set;get;}
public String contactId {set;get;}
public String leadId {set;get;}
public String contactName {set;get;}
public ProspectContactCntrl(ApexPages.StandardController stdController) {
recTypeLst = new List<SelectOption>();
recLst = new List<RecordType>();
recTypeLst.add(new SelectOption('','---Select---'));
List<RecordTypeInfo> infos = Prospect__c.sobjectType.getDescribe().getRecordTypeInfos();
set<id> recTypeIdLst = new Set<Id>();
// List<RecordType> recLst = [select id,name from RecordType where sobjectType = 'Prospect__c' and isActive = true];
for(RecordTypeInfo rec : infos)
{
if(rec.isAvailable() && !rec.isMaster()){
recTypeLst.add(new SelectOption(rec.getRecordTypeId(),rec.getName()));
recTypeIdLst.add(rec.getRecordTypeId());
}
}
recLst = [select id,name,Description from RecordType where id=:recTypeIdLst and sobjectType = 'Prospect__c' and isActive = true];
leadId = System.currentPageReference().getParameters().get('ldId');
contactId = System.currentPageReference().getParameters().get('conId');
if(contactId != null)
{
Contact con = [select id,name from contact where id=:contactId];
contactName= con.name;
}
}
You can convert this apex class so that it can be used in an LWC component or aura component. Some of the logic like getting the Id, conId from the page reference you will have to move to JS. Once you have extracted these Id's then you have to make an explicit apex callout passing the Ids as paramaters. The apex callout will receieve the Id's and perform the same logic that you are performing.