
You’re ready to start coding! You may have a task you want to automate or a project in mind but first, how do you get started? I use Visual Studio Code (VSCode) to do my coding when I’m programming in Apex, Salesforce’s custom programming language. Salesforce also endorses using Visual Studio; they even have a Trailhead dedicated to it. Let’s learn how to get VSCode setup for Salesforce development.
Configuring Salesforce Packages
First things first: let’s download Visual Studio Code. You can get the latest version here. Run the executable and then open up Visual Studio Code. You will then be greeted to this:

Click on the lowest icon on the left hand sidebar for Extensions:

There are a variety of extensions you can download for Salesforce specifically, like the Apex extension, the Apex debuggers, etc. but the two we will install are the Salesforce Extension Pack and Salesforce CLI integration. Search for them in the search bar and click Install. From here, you now have access to a few commands in the Command Palette. The Command Palette is a way for you to run commands that are built into Visual Studio Code natively or from extensions.
Connecting To A Salesforce Instance
Now that Visual Studio code is up and running, you need to connect it to the Salesforce org you are working out of. Click on ‘View’ then select ‘Command Palette’ (or press Ctrl + Shift + P). Then type ‘SFDX’ and you will see prepopulated commands. Choose ‘SFDX: Create Project with Manifest’.

This will kickoff some background processes to start connecting your org. You will first be asked to enter your project name:

Windows Explorer will open and ask you to specify the folder the project files will be stored locally:

Make a folder in a directory you keep projects in and then highlight it. Select ‘Create Project.’ Visual Studio Code will do a little processing and then you will have a skeleton project! If you navigate using the file tree on the left, you will see an option called ‘manifest.’ Click on it and you will see a single file called ‘package.xml.’

This file is what Visual Studio Code uses to talk to the Salesforce org and pull down the metadata locally. It has the most commonly used files like ApexClass and ApexPage prepopulated, but any other metadata you want to pull down aside from these can be added by simply adding the line(s):
<types>
<members>*</members>
<name>{API name for metadata}</name>
</types>
The asterik in the members attribute is a wildcard and it means you are pulling all files of this metadata type. You can do this if you want everything, or you can specify only pulling down certain values by deliberately naming them or using the wildcard character to select certain files. Say I was coding a project and I named all the classes beginning with the word ‘Ali.’ I could pull all these down by having this in my members tag:
<types>
<members>Ali*</members>
<name>ApexClass</name>
</types>
This would only pull down Apex Classes that start with ‘Ali’!
Pull From Salesforce Instance
Now that you have your package.xml and your Visual Studio Code project made, how do you connect to an org and get the data? Go to the Command Palette again and type in ‘SFDX.’ Select the option ‘SFDX: Authorize An Org’:

From here, select what type of org this is (Sandbox, Production, etc.), specify a name for the org, and a browser will open and direct you to login. Enter your credentials and allow Salesforce CLI Integration access to your org.

Now, when you right-click on the package.xml file in Visual Studio Code, you can choose the command ‘SFDX: Retrieve Source in Manfiest from Org’:

Click on it and give it a shot! When it’s done, you will see all the files you specified in the package.xml in your local project:

From here, you’re ready to code! You can now open your files and use Visual Studio Code as an IDE. When you want to upload a file back to the server, right click on it and select ‘SFDX: Deploy Source to Org’:

Visual Studio Code offers a lot of quality-of-life features on top of being a pretty robust text editor and file explorer. It can pre-populate commands and keywords that are used by Apex and other programming languages and can even give you tips on what methods need to work if you hover over them as you code and compile. Now that you’ve got VSCode setup for Salesforce development, the sky’s the limit. To get started, why not try creating a Lightning Web Component? Thanks for reading!
hi, And im sorry sir, but i do not know What should i do next? i am followed all steps until this point. thanks for your kind reply, and immage attached: https://imgur.com/i9pydAY
Follow this article to get a developer org:
https://developer.salesforce.com/docs/atlas.en-us.externalidentityImplGuide.meta/externalidentityImplGuide/external_identity_create_developer_org.htm
Then, when you get to the part you are stuck, click Production.