+ Start a Discussion
Hugh Wheeler 54Hugh Wheeler 54 

Scratch org person accounts

Hi there.

I have created a scratch org and tried to enable Person Accounts.  When I navigate to the org, person accounts is not switched on.  I am using the following Scratch Org Definition file.

{
  "orgName": "App Name",
  "edition": "Developer",
"features": ["PersonAccounts", "RecordTypes","AuthorApex", "Communities", "Sites", "ExternalSharing", "ForceComPlatform", "API", "AddCustomApps:2", "AddCustomTabs:2", "DebugApex", "DefaultWorkflowUser"],
  "settings": {
    "chatterSettings": {
      "enableChatter": true
    },
    "nameSettings": {
      "enableMiddleName": true,
      "enableNameSuffix": true
    },
    "accountSettings":{
     "enableAccountTeams": true,
     "enableContactHistoryTracking": true
    },
    "enhancedNotesSettings":{
     "enableEnhancedNotes": true
    },
    "apexSettings":{
     "enableDisableParallelApexTesting": true
    },
    "activitiesSettings": {
     "enableGroupTasks": true,
     "enableSimpleTaskCreateUI": true,
     "enableDragAndDropScheduling": true,
     "enableSidebarCalendarShortcut": true,
     "enableMultidayEvents": true,
     "enableRecurringTasks": true,
     "enableActivityReminders": true,
     "showEventDetailsMultiUserCalendar": true
    },
    "emailAdministrationSettings":{
     "enableEnhancedEmailEnabled": true
    }
  }
}

Has anyone successfully done this?  I was wondering if its got to do with the 3 conditions you need to meet for person accounts, but i'm not sure.
Best Answer chosen by Swetha (Salesforce Developers) 
Hugh Wheeler 54Hugh Wheeler 54
I tried something similar yesterday, although the above no longer works as OrgPreferences have been replaced with settings.

{
"orgName": "Demo Company",
"edition": "Enterprise",
"features": ["PersonAccounts", "FieldService", "Knowledge", "ServiceCloud", "Entitlements", "AuthorApex", "Communities", "DefaultWorkflowUser", "MarketingUser"],
  "settings": {
    "nameSettings": {
      "enableMiddleName": true,
      "enableNameSuffix": true
    },
    "chatterSettings": {
      "enableChatter": true
    }
  }
}

This seemed to work in building a scratch org.  The only thing I did differently was build it back up slowly changing one thing at a time and creating a ridiculous amount of scratch orgs as I went.

All Answers

SwethaSwetha (Salesforce Developers) 
HI Hugh,
Can you try with below snippet in Scratch Org Definition file and see if it succeeds?
{
  "orgName": "App Name",
  "edition": "Developer",
  "features": ["PersonAccounts"],
  "orgPreferences": {
    "enabled": ["ChatterEnabled"],
  }
}
Thanks
Hugh Wheeler 54Hugh Wheeler 54
I tried something similar yesterday, although the above no longer works as OrgPreferences have been replaced with settings.

{
"orgName": "Demo Company",
"edition": "Enterprise",
"features": ["PersonAccounts", "FieldService", "Knowledge", "ServiceCloud", "Entitlements", "AuthorApex", "Communities", "DefaultWorkflowUser", "MarketingUser"],
  "settings": {
    "nameSettings": {
      "enableMiddleName": true,
      "enableNameSuffix": true
    },
    "chatterSettings": {
      "enableChatter": true
    }
  }
}

This seemed to work in building a scratch org.  The only thing I did differently was build it back up slowly changing one thing at a time and creating a ridiculous amount of scratch orgs as I went.
This was selected as the best answer
SwethaSwetha (Salesforce Developers) 
Thanks for the details, Hugh. I will mark your answer as best to close the thread.