Steps to create scratch org in Salesforce DX
- Open the directory folder where the Salesforce DX code is present.
- Create scratch org with the help of a command palette or Terminal by authorizing dev hub.
To Authorize dev hub Press Ctrl+shift+P and type (Authorize a Dev Hub)
- Create a default scratch org again using Ctrl+Shift+P and type (Create a Default Scratch Org)
- Select option-project-scratch-def.json.
- Give alias to your org.
- Enter the number of days you want for your scratch org to be alive.
- Open the org Press Ctrl+shift+P and type (Open Default Org).
- Reset the password for the user. The steps are given below.
- Enable the country and state picklist. Click on each of the links in a serial manner given on each of the 4 points present on State and Country/Territory Picklists.
Select the United States in Default Country/Territory picklist and click on save. After that click on the 2nd option Scan Now and you will receive an email upon its completion and then click on the 3rd option Convert now.
After Clicking on Convert Now select United states in Change to picklist and click on Scan to Complete and then click on next.
After that Select California in Change to picklist and click on Scan to Complete and then click on Finish and Enable.
- Search for package manager in production org and select the desired stable package to install.
- Install production org package in Scratch org.
- Now your scratch org is ready to use.