I get this error message:

System.SObjectException: Business Account may not use Person Account field PersonHomePhone

When I try and load Person Accounts using Test.LoadData() below is the data:

GG,Graham,Green,,07970 123 123,
MB,Mary,Blue,,,07970 234 234

I followed the advice from a similar question, and try and change the Record Type Id after the load, but it never gets to this code:

    List<Account> personAccounts = new List<Account>();
    for (Account pa : accountList) {
        Account personAccount = new Account(Id = pa.Id, RecordTypeId = typeId);
    update personAccounts;

Is it possible to load Person Account fields using Test.LoadData() ?

  • Seems Business Account is the default record type on your profile. Try changing that to Person Account, and this should work then. However you may need different load files for Business Account and Person Account.
    – Jayant Das
    Oct 29, 2018 at 13:44
  • @JayantDas I don't want to load Business Accounts, I only want to load Person Account. But your answer/comment implies that it would not be possible to load both in this manner, because the profile has to be changed.
    – Robs
    Oct 29, 2018 at 13:50
  • I haven't tried it myself, but that's what it does look like. Because with the error it seems that the profile running this test class is having Business Account defaulted and thus cannot really load fields specific to Person Accounts unless that's defaulted. Without changing the profile, have you tried having the Record Type Id in your load CSV, and see if that works?
    – Jayant Das
    Oct 29, 2018 at 13:53
  • You could add a column for the record type to the csv, to make sure the records that are created have the proper record type. This could be painful when moving the code to a different org where the id's are different though. Oct 29, 2018 at 13:53
  • You have to add the Record Type Id to the csv.
    – Adrian Larson
    Oct 29, 2018 at 14:20

1 Answer 1


For now, you have to specify the record type ID in your CSV:

"sfdc fox","123-456-7890",012500000009cP9

If you're doing a migration between non-related orgs, that means you'd also have to modify the static resource for each org, since the record type ID will be different.

There's an Idea you could vote for so that maybe we'll get the ability to use something else for record types, particularly the DeveloperName.

Side note: Technically, you're supposed to be able to create related records via Test.loadData's alternative multi-record process, but this only results in a gack (internal server error) for now:

    Test.loadData(new RecordType().getSObjectType(), 'personrecordtype');
    Test.loadData(Account.SObjectType, 'personaccounts');




"sfdc fox","123-456-7890",012500000009cP9

I don't know when/if this would get fixed, but I'll see if I can find out more.

Class.System.Test.loadData: line 53, column 1
Class.TestLoadData.test1: line 4, column 1
08:06:38.0 (18283748)|FATAL_ERROR|System.UnexpectedException: Salesforce System Error: 299927037-4844 (-1054924158) (-1054924158)
  • So I need two CSV files? one for sandbox and the other for Production?
    – Robs
    Oct 29, 2018 at 14:41
  • 1
    @Robs Id values replicated from production will match. Any sandbox you create after creating the person account record type will have the same Id in each sandbox. The only time you would need two separate files would be if you create a record type in sandbox then move it to production.
    – sfdcfox
    Oct 29, 2018 at 14:47

You must log in to answer this question.

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