Salesforce Person Accounts can be a difficult model to understand. This post won’t be going over person accounts, however it will be going over how you can view and learn about person accounts in your own org without having to contact Salesforce support.
In order to create a Person Account org in Salesforce you have to follow several requirements and then contact customer support to activate the org. This can be a time consuming and cumbersome process. Especially if you are just trying to learn about Person Accounts and if they would be a good fit for your organization, or for personal development. The requirements can be viewed in Setup –> Account Settings:
Once activated it can not be deactivated. Instead of having to go through customer support and changing the org’s data model forever. there is a much more simple way. Through the use of scratch orgs. And with a few simple commands we can create a person account org in a few quick minutes. If you plan on following along I am assuming you have installed the Salesforce CLI and you have enabled a dev hub org. If not this trailhead will help.
First in a folder directory using the CLI we will create a project:
$ sfdx force:project:create -n personaccount
Now you have a project named: personaccount. Next go into the project folder you just created:
$ cd personaccount
Once the project is created we will need to modify the scratch org definition json. In the personaccount project go to the ‘config’ folder. In the folder is a project-scratch-def.json file. Open this file and modify the file to look something like this:
"orgName": "Demo company",
The most important part is the “PersonAccounts” feature, this activates person accounts when your scratch org is created. Authorize your dev hub (note this mus):
$ sfdx auth:web:login -d -a DevHub_Trailhead
Once authorized you are able to create scratch orgs:
$ sfdx force:org:create -s -f config/project-scratch-def.json -a PersonAccountScratch
After the person account scratch org has been created open the scratch org:
$ sfdx force:org:open
Now you have a person account scratch org where you can freely test to see if this is something that you find would be beneficial to activate. Note: the default expiration for scratch orgs is 7 days, if you make any changes and would like to keep them make sure you pull them down from source or upon creation expand the expiration days.
Now if you go to account settings you will see person accounts enabled:
Checkout My New Course:
Crush It As A Salesforce Developer: Mastering Apex
Test Your Knowledge:
Try the new Salesforce Developer Quiz