The Salesforce Developer Experience (DX) is a set of tools that streamlines the entire development lifecycle. It improves team development and collaboration, facilitates automated testing and continuous integration, and makes the release cycle more efficient and agile.
Advantages of Salesforce DX
·
It
helps improve team collaboration and development
·
It
makes the release cycle process more agile and efficient
·
It
allows developers to use any tool to modify the code such as CLI, VIM, Sublime,
Atom, etc.
·
Facilitates
automated testing for your code and enables continuous integration
·
Requires
a local development setup for developers to get hands-on expertise
Components of Salesforce DX:
·
VS
Code: Visual
Studio Code is the go-to code editor for Salesforce developers. It’s free,
open-source, and available for Windows, Linux, and macOS. This editor has
easy-to-install extensions for syntax highlighting, code completion, and more.
·
Salesforce
CLI (command-line interfaces): The Salesforce CLI is a powerful command-line interface
that simplifies development and builds automation when working with your
Salesforce org. Use it to aggregate all the tools you need to develop with and
perform commands against your Salesforce org. Synchronize source to and from
scratch orgs.
· Extensions in VS Code: The features that Visual Studio Code includes out-of-the-box are just the start. VS Code extensions let you add languages, debuggers, and tools to your installation to support your development workflow. VS Code’s rich extensibility model lets extension authors plug directly into the VS Code UI and contribute functionality through the same APIs used by VS Code.
The Salesforce Extension
pack includes tools for developing on the Salesforce platform in the
lightweight, extensible VS Code editor. These tools provide features for
working with development orgs (scratch orgs, sandboxes, and DE orgs), Apex,
Aura components, and Visualforce.
Setup
Dx Environment:
Install the
CLI on Windows
You install
the Salesforce CLI on Windows with an .exe file.
Download and run the Windows installer.
Run this
command to verify the Salesforce CLI version:
Sfdx –version
sfdx plugins –core
This command returns a list of the other plug-ins installed in the CLI:
Sfdx plugins
Download and Install VS Code:
VS
code can be downloaded from the below link.
Setup Salesforce DX with VS Code
Step 1: To setup Saleforce in VS Code, first install “Salesforce
Extension Pack”.
Step 2: To go for a Lightning Web Component in VS Code, first you need to install “Lightning Web Components”.
These are the steps required to set up and configure Salesforce DX on your system.
Create a Salesforce DX Project
via Command Palette
·
In
Visual Studio Code, open the Command Palette by pressing Ctrl+Shift+P on
Windows or Cmd+Shift+P on macOS
·
Type
SFDX
·
Select SFDX: Create
Project
·
Enter
HelloWorldLightningWebComponent as the project name
·
Press Enter
·
Select
a folder to store the project
·
Click Create
Project. You should see something like this as your base setup:
Authorize Your Non-DevHub Org via Command Palette
·
In
Visual Studio Code, open the Command Palette by pressing Ctrl+Shift+P on
Windows or Cmd+Shift+P on macOS
·
Type
SFDX
·
Select SFDX:
Authorize an Org
·
Select
the login option accordingly. Select login.salesforce.com to log into your
developer org or select test.salesforce.com to log in to the sandbox. You can
also use a custom domain URL to log in.
·
Log
in using your org.
·
If
prompted to allow access, click Allow.
· After you authenticate in the browser, the CLI remembers your credentials. The success message should look like this:
- Make sure that you have
installed Java 8 or Java 11 and configure the path on your system.
- If you are not able to
retrieve or deploy components and you’re getting “UNSUPPORTED_API_VERSION: Invalid Api version specified on URL”
message, then execute the following command: “sfdx force:config:set
apiVersion=48.0” and select the previous version in it.