I have a Lead that is automatically converted using a trigger. The default Record Type for this profile is Person Account and it works as expected. Now I need to explicitly set the Account Record Type for the conversion process as the profile should create different Record Types in the future.

First question: How can I explicitly set the Account Record Type for Lead conversion in Apex?

Second question: I have a unit test for the current behavior. I set the same profile for Lead creation and Lead conversion, but for some reason, I always end up with a Business Account. Any idea why?


There's no way to set account record type during a lead conversion. You will have to create the account first, before the lead conversion, and then use setAccountId() on the LeadConvert object to link the converted contact to the account.

| improve this answer | |
  • Straightforward solution - Salesforce style. :D Thx! – Semmel Aug 27 '18 at 15:40
  • Then lead field mapping configuration is useless. – Ablue Aug 22 '19 at 0:36

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.