How to configure vs code for salesforce

image

How to setup VS Code for Salesforce

  • Go to https://code.visualstudio.com/download and download the correct version for your machine
  • Once installed, launch the program
  • Download both Salesforce CLI and the Salesforce Extension pack (you are working on getting the Salesforce DX set up)
    If…
  • If you are running Catalina and cannot install the Salesforce CLI package, you are…

Full
Answer

How to connect VSCode with Salesforce?

Our project is ready on our local machine, Its time to connect our VsCode with Salesforce. Again open Command Palette or press Ctrl + Shit + P. This time we need to type or Select “ SFDX: Authorize an Org “. In the last step you need to provide the org alias name. Then it will take you to your default browser and ask you for org credentials.

How to authorize Salesforce Org using VS Code?

Enter your credentials Once successfully login to the Salesforce Org. visit the VS Code again and sure enough we get the notifications to successfully authorize the Org. Hope you enjoyed this article.

What are the system requirements for Salesforce extensions for VS Code?

Some features in Salesforce Extensions for VS Code depend upon the Java Platform, Standard Edition Development Kit (JDK). You need to have either version 8 or version 11 of the JDK installed. See Java Setup for details.

Is VS Code the best IDE for Salesforce?

So, if you haven’t heard of VS Code yet, it is a very lightweight, easy-to-use, and extensive IDE with built-in support for Salesforce and Git. It features keyboard shortcuts, support for debugging, and other features like syntax highlighting and code completion.

image


Install & Configure Visual Studio Code

We can download the latest VS Code Setup from the following Url: https://code.visualstudio.com


Install & Configure Salesforce Extension Pack

On the left most menu panel, Click Extensions Icon of press “Ctrl + Shift + X” & Search for “Salesforce Extension Pack”. Install Salesforce Extension Pack by clicking “Install” and wait till installation completes


Create Test Salesforce Project

Press “Ctrl + Shift + P” to see all available commands from all installed plugins & extensions


Authorize Salesforce Org

Enter the Org Alias to recognize you Org by alias, I have specified “ SFOrg ” as alias for this demo


Follow Along with Trail Together

Want to follow along with an expert as you work through this step? Take a look at this video, part of the Trail Together series on Trailhead Live.


Install Salesforce Extensions for Visual Studio Code

Visual Studio Code is the go-to code editor for Salesforce developers. It’s free, open-source, and available for Windows, Linux, and macOS. This editor has easy-to-install extensions for syntax highlighting, code completion, and more.


Ensure Your Development Environment Is Ready

Now that you’ve installed Visual Studio Code and enabled the necessary extensions, you need to test them out.


Verify Step

You’ll be completing this project in your own hands-on org. Click Launch to get started, or click the name of your org to choose a different one.


How to Set Up VS Code for Salesforce Development

Since the Spring ’18 release, Salesforce has been trying to get users to switch to Microsoft Visual Studio Code (VS Code) with the retirement of the Force.com IDE Eclipse. So, if you haven’t heard of VS Code yet, it is a very lightweight, easy-to-use, and extensive IDE with built-in support for Salesforce and Git.


Download Visual Studio Code

To get started, we first need to download and install the VS Code IDE in our system.
You can download the latest version of VS Code here. After installing it, you will see a screen as shown below:


Install SFDX Command Line Interface

As discussed, to use VS Code for Salesforce development, we need to install the Salesforce Extension Pack. But before that, we also need to install the Salesforce DX Command-line Interface (SFDX CLI). SFDX CLI is a very powerful tool which can simplify your development journey drastically.


Install the Salesforce Extension Pack

This pack contains a set of extensions which you can use to create and work with various orgs, Apex, Aura components, Visualforce, and whatnot. To install them, open your VS Code and click on the extensions button in the left bar. Search for “Salesforce Extension Pack” in the search box. A window similar to the one below will open.


Follow Along with Trail Together

Want to follow along with an instructor as you work through this step? Take a look at this video, part of the Trail Together series on Trailhead Live.


Terminal Versus Command Palette

Like with any good development tool, there is more than one way to do things with Visual Studio Code. The two main ways you can interact with Salesforce CLI are through the integrated terminal or quick open window.


Create a Project

Press Command + Shift + P on Mac or Ctrl + Shift + P on Windows to make the command palette appear.


Search your Files

Press Command + P on Mac or Ctrl + P on Windows to make the search palette appear. This shifts the focus to search files.


Authenticate to Your Playground

Press Command + Shift + P on Mac or Ctrl + Shift + P on Windows to make the command palette appear.


Create an Apex Class

Click the Explorer icon in Visual Studio Code to expand the force-app folder.


Query

Our new Apex class has a SOQL query in it, but we want to make sure it works as we expect before we deploy it to our org. We use the command palette to run the query against our org.


What version of JDK is needed for Salesforce?

Some features in Salesforce Extensions for VS Code depend upon the Java Platform, Standard Edition Development Kit (JDK). You need to have either version 8 or version 11 of the JDK installed. See Java Setup for details.


What is Salesforce CLI?

Salesforce CLI is used to execute commands against Salesforce orgs and work with source files on your local machine. Salesforce Extensions for VS Code uses Salesforce CLI behind the scenes, so even if you don’t want to use the CLI directly you need to install it on your machine.


What is code version?

Code-version is a version created on your sandbox and the name can differ, so once you get your sandbox, check which version you need to use in Administration > Site Development > Code Deployment. Note: do NOT share your dw.json file, since you will share your personal details with the third party!


Is VSC supported on Windows?

VSC is supported for Windows, Mac, and Linux. After downloading the installer, simply follow the instructions to install VSC on your machine. Once your installation is done, you will see the following screen.


Is VSC better than IntelliSense?

VSC has faster cartridge uploading and a better templating engine, which is more attractive to most developers. VSC can be easily extended with extensions and it provides some cool and effective features, such as IntelliSense that analyzes code and the semantics of what you are inputting.

image

Leave a Comment