I recently started a new role as a Salesforce Developer at a small startup consultancy. For the first time, I had to set up Visual Studio Code for Salesforce. VS Code is the most appealing option due to its suite of Salesforce add-ons and SFDX integrations.
Here, I will explain how to connect VS Code to a Salesforce org step by step. Then, we will see how to create an Apex class to fetch data from the org, deploy the Apex class, and execute the Apex code in VS Code.
Connect VS Code to Salesforce Org
In the following steps, I explained how to set up VS Code and connect to the Salesforce org.
1. Download and Install VS Code
First, you need to download and install VS Code on your system. Here, you can see the different OSs available, and you need to download VS Code according to the OS installed on your system.

2. Download and Install Salesforce CLI
The Salesforce DX CLI (Command-Line Interface) is a tool for developers working with Salesforce. It allows you to interact with your Salesforce orgs, manage source code, and automate tasks via the command line.
You need to install Salesforce CLI on your system, and for that, you need to download the CLI according to the OS installed on your system.

Once you complete the CLI installation process, to check whether the CLI is installed in your system, go to the command prompt and enter ‘SFDX‘(Salesforce Developer Experience). You will get the CLI VERSION and other information if the CLI is successfully installed.
