Responsive Advertisement

Setting up your local salesforce development environment


If you are a salesforce developer, then it is most likely that you have used visual studio code for development at least once. If not or you are struggling with the setup, here is a step by step guide how you can set up your local development environment and customize to your liking.

Install VS Code

Of course. To use it you have to download and install it. Visual Studio Code is one of the most popular cross-platform text editors. Though it is a powerful text editor, with the power of extensions you can covert it into an IDE suitable for any language. Also, it is the recommended IDE for salesforce development by salesforce.
To download, visit 🌐code.visualstudio.com. Choose the appropriate operating system and architecture applicable to your machine and download the installer. After that you have to install it. Just follow the standard process. For windows users, select Add to path, so that later you can use command to open it from terminal and can act cool that you know how to use terminal 😎. For mac and linux, I guess it automatically adds it to the system path, so you do not need to do anything extra.

Documentation on how to install


Install NodeJS

Next you need to install nodejs. The salesforce project that we build in vscode is nothing but a nodejs application. Download and install the LTS version from nodejs.org. In the installation steps if it asks to add to path, select yes. Also install the build-tools if the option appears. Keep in mind, the build-tools is a rather large package (around 3GB), unlike the nodejs installer. Once installed, open terminal and verify your installation.

node and npm version check


Install Salesforce CLI

The Salesforce CLI is a powerful command line interface that simplifies development and build automation when working with your Salesforce org. Install it from developer.salesforce.com. Read the setup guide.


Install Java Development Kit

The salesforce cli and salesforce extension for vscode depends on Java for some of its features. You need to install Java verison 8 or 11. Please do not install any other versions of Java. If you already have Java on your machine, verify the Java version and install the required version if necessary. I recommend the zulu jdk. It will help you setup salesforce dataloader as well. Read the setup guide.

salesforcedx java home in my settings.json


Install Salesforce Extension Pack for VSCode

Now lets power up vscode for Salesforce development with the official salesforce extension from vscode market place.


Prerequisites (source: marketplace.visualstudio.com)

Before you set up Salesforce Extensions for VS Code, make sure that you have these essentials.
  • NodeJS
NodeJS is a JavaScript runtime environment based Google's V8 engine. It lets you run JavaScript outside your browser. Salesforce CLI requires NodeJS to be installed first.
  • Salesforce CLI
Before you use Salesforce Extensions for VS Code, set up Salesforce CLI.
  • A Salesforce DX project
Open your Salesforce DX project in a directory that contains an sfdx-project.json file. Otherwise, some features don’t work.
If you don't already have a Salesforce DX project, create one with the SFDX: Create Project command (for development against scratch orgs) or the SFDX: Create Project with Manifest command (for development against sandboxes or DE orgs). Or, see create a Salesforce DX project for information about setting up a project using Salesforce CLI.
  • Java Platform, Standard Edition Development Kit
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.
If you don’t already have version 8 or 11 of the JDK installed, you can install the latest version of the Java 8 JDK from Java SE Development Kit 8 Downloads or the latest version of the Java 11 JDK from Java SE Development Kit 11 Downloads.
If you also use other versions of the JDK, set your VS Code user setting salesforcedx-vscode-apex.java.home to point to the location where you installed Java 8 or 11.

Once all the above steps are done, you can start creating your salesforce project. Follow these steps.
  • Open VS Code
  • Open View
  • Select Command Palette... (or Cmd + Shift + p on mac Ctrl + Shift + p on others)
  • Type SFDX: Create Project and hit Enter
  • Select Standard project template and hit Enter
  • Select the directory where you want to save your project
  • Once the project is ready, open the command palette again
  • Type SFDX: Create Apex class and hit Enter
  • Name it AccountExtController and hit Enter
  • Select the default folder and hit Enter
  • In the boiler plate code start typing System and put a period (.)
If you are able to see suggestions, congratulations you have successfully setup vscode for your salesforce development with all the salesforce language support and intellisense. Next, you might want to authorize your salesforce org with the current project and pull all the metadata that you want.


Recommendations

These are some of the recommended extensions.

One Dark

Post a Comment

3 Comments