You need to sign in to do that
Don't have an account?

is there any way to restrict contact conversion while converting lead record ?
Hi all
i have one requirement i am converting lead to account using custom logic preventing Opportunity creation i need to prevent contact convertion also by suing any logic any one have any idea
please find below code which i am using
@AuraEnabled
public static id convertlead (Id recordId){
id accountid;
lead le = new lead();
le.Id=recordId;
le.RecordTypeId = Schema.SObjectType.Lead.getRecordTypeInfosByDeveloperName().get('Business_Insurance').getRecordTypeId();
system.debug('recordtypeid--> '+le.RecordTypeId);
Database.LeadConvert lc = new Database.LeadConvert();
lc.setLeadId(le.Id);
system.debug('lc value --> '+lc);
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
lc.setConvertedStatus(convertStatus.MasterLabel);
lc.setDoNotCreateOpportunity(true);
Database.LeadConvertResult lcr = Database.convertLead(lc);
accountid =lcr.getAccountId();
return accountid;
}
Thanks
surender Reddy