Before we start with CLI and Visual Studio Code installation, let’s have a quick CLI overview.
In simple terms, Salesforce CLI is a command-line interface that helps to create and manage orgs, create and install packages, also used to authorize Dev Hub org, and much more.
Command-line Interface is a savior that simplifies development and also setup automation with Salesforce org.
Basic Requirement of System
To get the most out of Salesforce CLI, it’s better to review your system for these features;
CLI for Salesforce supports below mentioned operating systems.
Windows—Windows 8.1 and Windows Server 2012 (64-bit and 32-bit) or later
Mac—macOS 10.11 or later
Any code editor would be sufficient, either VSCode or IntelliJ IDE. To begin with, here we will use VS Code and the Salesforce extensions for development on the Salesforce Platform.
So let’s begin with Visual Studio Code Installation.
Visual Studio Code Setup
Follow the below-mentioned steps to get the latest IDE for Salesforce Development, i.e., VSCode.
- Download and Installation of VS Code
To download the latest version of Visual Studio Code, just follow this link Download VSCode. Choose any as per your machine. Once downloaded, open VSCode, and you’ll see the welcome screen.
Download and Install Salesforce CLI
Before you install salesforce CLI, first check whether it is already installed in your system. For this open command prompt and run this command “sfdx -v” or “sfdx.”
If it is not installed, you’ll get something like shown in the below screenshot.
- After getting this confirmation, just follow this link to download Salesforce CLI and choose as per your machine.
Once you are done with the installation, it’s time to check again, open the command prompt again, and write again “sfdx” or “sfdx – v.” If successfully installed, you’ll see something like shown in the below screenshot
- Salesforce Extension Pack Installation
Now to access Salesforce in VSCode, you need to have this plugin in VSCode. This gives access to the developers to have a Salesforce-ready environment.
For this, go to VSCode, and on the left side, you’ll see the extension icon-search bar type “Salesforce Extension” and select the first extension.
It will show an option to install this extension. Click on Install.
This extension has tools for developing on Salesforce Platform, and this pack contains extensions:
2. Apex Interactive Debugger
3. Apex Replay Debugger
4. Salesforce CLI Integration
5. Aura Components
7. Lightning Web Components
8. SLDS Validator
- Connect and Authorise Salesforce Org
We have now successfully installed VSCode and CLI; the last step is to connect this with our Salesforce org(can be Sandbox, Production, or any custom environment).
To connect an org, click on gear like icon and select command palette or use shortcut key CTRL+SHIFT+P; from here, you can use various commands to create and run your code.
Implementation of this we will see in our next blog. (Link of Connect and Authorise Salesforce Org blog)
Links to refer:
- Visual Studio Code Extensions for Salesforce
- Salesforce CLI