Tuesday 1 December 2020

 

How to setup Visual Studio Code for Salesforce


Step1: 

Install the Salesforce CLI https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm

While installing check box should be true for set path, its automatically set the path.

Open comand promt type: sfdx 

sfdx update - it updates the version If any latest


Step 2:

Install Visual Studio Code 

Open vs code: Click on extensions icon on left side : search Salesforce Extension Pack and install


Step 3:

Create a project in VS Code

cntl+shift+p-> Create a project with manifest

Again select: Create a project with manifest -> Standard --> Project name

New project is created,


Step 4:

Connect with Salesforce

In vs code command palette : Authorize an Org

Select Production/Sandbox

Give alias name and enter -> It takes you to salesforce login page

login - allow access

In VS code - open package.xml under your project-manifest 

Right click on package.xml -> click on Retrive source in Manifest from Org

Add components to package.xml whatever compoenents you need like objects....


Step 5:

Deploy changes to source org

There are two ways we can do

1) Right click on Code that you have worked -> click on Deploy this source to org

2) Deploy on Save -> Open command palette --> Open User settings --> Search of Deploy on Save --> Check the box Push or Deploy on Save (fsdeploy package)


Step 6:

Create apex class/components/triggers

In vs code command palette : create apex class/components/triggers.......