Tuesday, May 28, 2019

Setup Visual Studio Code(VSC) for Salesforce Development without Scratch Org

This is a step to step guide to setup Visual Studio Code for salesforce development without using Dev-Hub and Scratch Orgs, you can now use vs code for your Dev Org and Sandboxes just like any other IDE, also this will allow you to push your manifest at many org at once and even sync it with your Code Repository.



1. Install Salesforce CLI from this link https://developer.salesforce.com/tools/sfdxcli, if already installed make sure you have the latest version.
2. Download and Install Salesforce VsCode from here https://code.visualstudio.com/, if already installed make sure you have the latest version.
3. Install “Salesforce Extension Pack” from Extensions Marketplace in VS Code.

4. In the Terminal window, run the following command,
sfdx plugins:install salesforcedx@pre-release
If the terminal is not visible on UI then go to Menu->View->Terminal
5. Create a Project
  • Press “CTRL+SHIFT+P” then select  “SFDX: Create Project with Manifest
VS Create Project with manfest
  • Then enter your Project Name and select a folder where you want to keep all your local copy of Manifest and ProjectFiles.
Enter project name
6. Authorize your Dev Org or Sandbox
  • Press “CTRL+SHIFT+P” then select  “SFDX: Authorize an Org
Authorize Dev Org7. Select Org Type
Enter Org Type
After Successful login, you can close the browser and you can notice that few files and folder are now displayed in the left sidebar.
8. Retrieve Metadata
  • Now we will be retrieving all the necessary manifest to make changes, for that expand the manifest folder and open package.xml in the editor. (If you are working on fresh org you can skip this step)
  • Edit package XML to retrieve desired components from the authorized org.
  • After that right click on package.xml either in Explorer or in the Editor Window and click on SFDX: Retrieve Source in Manifest from Org
Retrieve Metadata
After the retrieval process is completed you can see your metadata in force-app folder in the explorer.
9. Deploy Metadata
  • After you are done with changes in your Metadata, just right click on that file and click on SFDX: Deploy This Source to Org, it will deploy your changes to Authorized org and remember that the source you deploy overwrites the corresponding metadata in your Org
Deploy Metadata
Good luck with the development in VS Code and say goodbye to other IDEs.
Some useful links:
1. Salesforce CLI Documentation

No comments:

Post a Comment