Salesforce DX allows developers to create Scratch Orgs, these scratch Orgs are the used to build an application using Source-driven development. As per Source-driven development, Source code is stored in Version Control systems (VCS).
Salesforce Dev Hub Setup
To create Scratch Orgs, enable Dev Hub in our Salesforce organisation, download & Install Salesforce DX CLI and configure Salesforce Dev Hub setup.
- By enabling Dev Hub in Salesforce, we can create and manage Scratch Orgs from command line.
- We can view Scratch Org information and link namespace Orgs.
Enabling Salesforce Dev Hub
Following the steps given below.
- Login to your Production Org (or) business Org. User can start using the trail version of the developer hub at https://developer.salesforce.com/promotions/orgs/dx-signup. The trail edition is valid for 30 days.
- Navigate to Develop | Dev Hub or enter Dev Hub in the Quick Find box.
- Click on enable, to enable Dev Hub and also enable unlocked packages and second generation managed packages to develop 2GP packages.
- Enable packaging to develop and distribute unlocked packages for salesforce customers.
- To develop and distribute second-generation manages packages for Salesforce partner.
Download Salesforce CLI
Salesforce Command Line Interface (CLI) is a powerful tool which removes complexity and deliver flexible and configurable Scratch Orgs. To create Scratch Org, Salesforce CLI should be installed in your local system.
Depending upon the Operating system, download Salesforce CLI from below table.
Operating System | Salesforce CLI Installer |
mac OS | https://sfdc.co/sfdx_cli_osx |
Windows 32-bit | https://sfdc.co/sfdx_cli_win |
Windows 64-bit | https://sfdc.co/sfdx_cli_win64 |
Debian / Ubuntu 64 | https://sfdc.co/sfdx_cli_linux |
Debian / Ubuntu x86 | https://sfdc.co/sfdx_cli_linux_x86 |
Now Install Salesforce CLI in your local system. To check that installation is successful, open Terminal app in Mac and enter sfdx as shown below.
Salesforce Dev Hub setup login
We must create an alias DevHub and make it a default org. To create use the following command in terminal command window. Then a new salesforce login page will be opened, enter username and password.
- Click allow to Allow access.
After authenticating the following message will appear on terminal.
Successfully authorized prasanth@tk.com with org ID 00D6F000002SEW1UAO
You may now close the browser