Setup Visual Studio Code IDE for Salesforce Development
9:46 AMThis article covers the step by step instructions to setup Visual Studio Code (VSC) as an IDE for Salesforce Development. Originally VSC only worked with SFDX projects but now it supports general salesforce development as well as SFDX projects. This article only covers general salesforce development (connecting to a sandbox / developer org ). In a follow up article we will cover some exciting features of this new IDE.
Why VSC?
- Officially supported IDE by Salesforce.
- Eclipse IDE is no longer supported.
- VSC is open source, light weight and enables rapid force.com development.
- Rich debugging capabilities.
Step 1: Install Visual Studio Code
Java 8 is required. Make sure you download the latest from here https://www.java.com/en/download/.
Install VSC from the link https://code.visualstudio.com/ . Note that version 26 and higher is required. If you are running a older version, just download and install the latest from the link.
Install VSC from the link https://code.visualstudio.com/ . Note that version 26 and higher is required. If you are running a older version, just download and install the latest from the link.
Step 2: Install the Salesforce Extension Pack
Install from the link https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode or just search for the extension directly in the IDE as shown below.
Note that since I have already installed the extension the button shows up as 'Uninstall' for me. If doing for the first time, this should show as 'Install'.
Note that since I have already installed the extension the button shows up as 'Uninstall' for me. If doing for the first time, this should show as 'Install'.
Step 3: Create a new project with Manifest
Open the command palette (press Ctrl+Shift+P on Windows or Linux, or Cmd+Shift+P on macOS) and enter the command 'SFDX: Create Project with Manifest'
If you do not see the option ('Create Project with Manifest'), you might try restarting your IDE or verify if all per-requisites are met.
Step 4: Authorize an Org
Open the command palette (press Ctrl+Shift+P on Windows or Linux, or Cmd+Shift+P on macOS) and enter the command 'SFDX: Authorize an Org'
Use Production for developer / production org. Use custom if you org has a custom mydomain enabled. A browser window opens up, enter your credentials and return back to the IDE after successful login.
Step 5: Download metadata from the Org
Note that a default package.xml is created with pre-filled in metadata. To download just the content in the package just right click the file and choose 'SFDX: Retrieve source in manifest from org'. You could modify the package.xml to retrieve other metadata components not listed.
You will now notice that the folders below are populated with files from your org.
Step 6: Edit files and deploy
Edit any file and deploy by right clicking the file and selecting the deploy option. Note that the output window gives you the status of your deploy.
2 comments
Hello Force Tree,
ReplyDeleteThanks for the details.. I've installed the latest versions of VScode, the Salesforce CLI, and the VS code Salesforce CLI Extension but when I go to run SFDX: Create Project with Manifest or any SFDX command, I receive an error such as 'command 'sfdx.force.project.with.manifest.create' not found'
What can I do to fix this?
Hi Nazeer. Happened to me as well. Try restarting or going over the installations one more time. Not sure what's the cause, but the commands eventually showed up after a couple installations.
Delete