function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
topsecretguytopsecretguy 

Person account creation on lead conversion

I'm writing a test class that creates a lead and converts it.  On conversion 2 new contacts are created through a trigger using data from the lead and it's this contact creation that I'm testing for.

 

The save result reports the following:  "Can not select a person account"

 

My contacts are being created using the account Id of the account created on conversion,  so,  I assume it's this account that is being created as a person account.  How can I ensure that the account created on conversion is a business account?

 

The code works perfectly well when I'm running it through the GUI and as far as I can tell,  I'm creating the lead using the same recordtype and other data.

 

Any thoughts?

topsecretguytopsecretguy

Thanks for the link,  unfortunately,  I wasn't able to resolve the issue.

 

To clarify,   here's what's happening:

 

In a test class

  1. Create lead with record type x and convert
  2. Resulting account is person account

In the GUI

  1. Create lead with record type x and convert
  2. Resulting account is business account

Why?