Visual Studio Code (VS Code) is a popular, lightweight code editor used by Salesforce developers to write, manage, and deploy our code efficiently. This guide will walk you through the full setup process for using VS Code with Salesforce .
What You’ll Need
Before diving in, make sure you have:
- A Salesforce Developer or Sandbox org
- Internet connection 😜
Step 1: Install Visual Studio Code
- Go to the VS code website to download or click here
- Choose your operating system (Windows/macOS/Linux).
- Download and run the installer.
How to Set Up Visual Studio Code for Salesforce Org
Step 2: Install Salesforce CLI
Salesforce CLI (Command Line Interface) is required to authenticate and interact with Salesforce orgs from VS Code.
- Go to the Salesforce CLI download page.
- Download the correct version for your OS.
- Install it by following on-screen instructions.
✅ Verify installation: Open Terminal/Command Prompt and type
sfdx --version
.
Step 3: Install Salesforce Extensions in VS Code
- Launch VS Code.
- Click the Extensions icon (or press
Ctrl+Shift+P
/Cmd+Shift+P
). - Search for Salesforce Extension Pack or Salesforce Extension Pack (Expanded) (Anyone of this you can install)
- Click Install.
The Salesforce Extension Pack (Expanded) is recommended as this pack includes :
- Salesforce CLI Integration
- Apex
- Apex Interactive Debugger
- Apex Replay Debugger
- Lightning Web Components
- Aura Components
- Visualforce
- SOQL
- Agentforce for Developers
- Salesforce Code Analyzer
It also includes the following community-built extensions.
- Apex Log Analyzer .
- Prettier
- ESLint
- Apex PMD
Step 4: Create a Salesforce DX Project
- Open Command Palette:
Ctrl+Shift+P
(Windows) orCmd+Shift+P
(Mac). - Type
SFDX: Create Project with Manifest
. - Give your project a name.
- Choose a folder location.
This will generate a project structure with folders like force-app
, config
, and manifest
.
Step 5: Authorize Your Salesforce Org
To connect your local setup to Salesforce:
- Open Command Palette again :
Ctrl+Shift+P
(Windows) orCmd+Shift+P
(Mac). - Select
SFDX: Authorize an Org
. - Choose between:Project Default
login.salesforce.com
(Production or Developer)
test.salesforce.com
(Sandbox)
Custom Url
Enter an alias after selecting any one from above (e.g., SFHours).
Log in through the web browser window that opens. Then enter login Credential of Salesforce org .Once you enter that a prompt screen will come up like this:
Once you allow that you will again prompt with Authentication Successful message
Once you see this screen , you can go back to your VS code and check the terminal with this message “Successfully authorize ”
Boom 👏 !!!! ALL SET NOW !!!!
YOU Have Successfully SETUP Your VS Code with Salesforce org
Step 6: Retrieve Component from Salesforce using VsCode
Now ,You’ll want to pull down existing components of Salesforce in VS Code:
- Go to
package.xml
(in themanifest
folder). Then right click on “package.xml".
- Select
SFDX: Retrieve Source in Manifest from Org
.
It’ll retrieve all the metadata from your org which is specified in your package.xml file .Your metadata will now be downloaded to the
force-app
folder.
You can see the list of retrieved component list in VS CODE Terminal output
Step 7: Deploy Code to Salesforce
- Navigate to the component you modified or created.
- Right-click the file and select
SFDX: Deploy This Source to Org
.
✅ Tip: You can also deploy the entire project by right-clicking the
force-app
folder.
Common Commands Cheat Sheet
Action | Command |
---|---|
Create Project | SFDX: Create Project with Manifest |
Authorize Org | SFDX: Authorize an Org |
Retrieve Metadata | SFDX: Retrieve Source in Manifest from Org |
Deploy Source | SFDX: Deploy This Source to Org |
Run Tests | SFDX: Run Apex Tests |
Summary
I hope this post helped you to understand how to set up vsCode in Salesforce. If you face any issue while doing these steps , please let me know in the comment box .I will try my best to help you out .
Keep sharing and give us valuable feedback that can help us to imporove our content better for you .
Tags
Discover more from Salesforce Hours
Subscribe to get the latest posts sent to your email.