I am using Database.Leadconvert to convert lead into account and Opportunity. So while converting there is validation in account object for a custom field, that we need to pass Business type while creating account
List<Database.LeadConvert> massLeadConvert=new List<Database.LeadConvert>();
for(Id currentLead:LeadIds){
Database.LeadConvert LeadConvert=new Database.LeadConvert();
LeadConvert.setLeadId(currentLead);
LeadConvert.setOwnerId('0053z00000HCRRlAAP');
LeadConvert.setConvertedStatus(cLeadStatus.MasterLabel);
LeadConvert.setDoNotCreateOpportunity(false);
massLeadConvert.add(LeadConvert);
}
In the above code I need to pass that custom field while creating account so I tried in this way
Map<String, Object> accountFieldMap = new Map<String, Object>();
accountFieldMap.put('BusinessType__c', 'Group');
LeadConvert.setAccountFieldMap(accountFieldMap);
But I am getting method does not exist error and seems its deprecated.
I dont want to create a custom field in Lead object and map that field to account because depends on this Businesstype field there are some other validation rule also on account saying if Business type is 'Group' then there is a field named Known name which must not be empty. So cant't all custom fields in Lead which ever is necessary for Account.
Is there a way we can set custom field values during Database.Leadconvert?