0

I have a Field called "Business Type" on LEAD which is of type picklist. I am using LeadConvert method to convert a lead to Account, contact, Opportunity. While I convert the lead, I want to assign the recordtype of the account dynamically with respect to "Business Type". How is this possible when using LeadConvert Class. At present, a default recordtype of account is getting assigned when a lead is converted.

Documentation for LeadConvert class: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_dml_convertLead.htm

1

In addition to DavidCheng suggestion,

If you map the value of Lead.BusinessType to a field in Account, say Account.Business_Type__c (via Lead Mapping), then you can either use

  • Before Save Flow to coerce the Account.RecordtypeId
  • Before Insert Trigger to coerce the Account.RecordtypeId
2

It's not possible to specify an Account record type during lead conversion. Either you'll have to create the account before the lead conversion and use setAccountId(), or change the new account's record type after lead conversion using on the ConvertedAccountId field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.