2

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?

1 Answer 1

3

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.

2
  • Straightforward solution - Salesforce style. :D Thx!
    – Semmel
    Aug 27, 2018 at 15:40
  • Then lead field mapping configuration is useless.
    – Matt
    Aug 22, 2019 at 0:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .