VS Code Commands Cheatsheet for Salesforce Developers


Whether you’re setting up your Salesforce project, retrieving metadata, or deploying source code, having a handy VS Code command reference can save a lot of time. This cheatsheet covers essential CLI commands and useful tips for Salesforce development using Visual Studio Code.

⚙ Project Setup & Org Authentication

Start your Salesforce journey by setting up the project and authenticating with your org using the Salesforce CLI (sfdx).

sfdx force:project:create -n YourProjectName
sfdx force:auth:web:login -a OrgAlias


📤 Source Deployment & Retrieval

Push or pull source to/from your Salesforce org:

sfdx force:source:push
sfdx force:source:pull
sfdx force:source:deploy -p path/to/component
sfdx force:source:retrieve -p path/to/component


🧪 Testing & Debugging

Run Apex tests and debug issues:

sfdx force:apex:test:run --resultformat human
sfdx force:apex:log:get --number 1
sfdx force:data:soql:query -q "SELECT Name FROM Account"


🧬 Data Commands

Handle data in your org with ease:

sfdx force:data:tree:export -q "SELECT Name FROM Account" -d ./data
sfdx force:data:tree:import -p ./data/Account-plan.json


🧠 Useful VS Code Shortcuts

  • Ctrl + Shift + P: Open Command Palette
  • Ctrl + P: Quick file navigation
  • Ctrl + /: Comment/uncomment code
  • Ctrl + B: Toggle sidebar

📚 Bonus Tips

  • Install the Salesforce Extension Pack in VS Code.
  • Use the command below to create an LWC component: sfdx force:lightning:component:create -n myComponent -d force-app/main/default/lwc
  • Create an Apex class with: sfdx force:apex:class:create -n MyClass -d force-app/main/default/classes

This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.