Hello friends, Please go through earlier Chapters in the Series before starting this one.
Chapter 1: Introduction to Lightning Web Component
Chapter 2: Install Developer Tools for LWC
In this Chapter we will learn how to Setup SalesforceDX (SFDX) for Sandbox, Developer and Production Orgs. In short we will discuss how to use SFDX with non Scratch Orgs
Topics Covered:
- Org Development Model
- Steps to Setup SalesforceDX (SFDX) for Non Scratch Orgs
Development Model
Salesforce Extensions for VS Code supports
- Org Development Model
- Package Development model
In this chapter we will learn Org Development Model
Org Development Model:
Allows you to work with orgs that don’t have source tracking, such as sandbox, Developer Edition (DE) org, Trailhead Playground, or even a production org to retrieve and deploy code directly.
Step 1: Create Project with Manifest
To create developing against non-source-tracked orgs:
Open the VS Code editor and from the Command Palette, run SFDX: Create Project with Manifest.
Choose Standard
Select Location where the project will be saved
Enter project name
Project is Created
The Manifest (package.xml) File
After connecting to a sandbox, DE org, or Trailhead Playground, use the package.xml file to retrieve the metadata from your org. When you run SFDX: Create Project with Manifest command, a package.xml file is created.
Step 2 : Authenticate your Sandbox/Developer org
Select Project Default / Production / Sandbox / Custom according to your requirement
Give the org alias
On the bottom right it will show “Authorizing an Org”
Sign to the org
Command displays authorizing an org
Step 3: Retrieve and Deploy Source
Create an Apex Class
Give the class name
The location in which class will get saved
Terminal displaying that apex class is created
Deploy Source to Org
When you deploy the code changes, the local version of the source files overwrites the metadata in your org.
You can notice class has been deployed to the Salesforce org
Retrieve Source
Now make changes to the class in the org
Retrieve Source from org
Org Development model doesn’t automatically track changes to your org. Retrieving source from an org overwrites the local versions of the source files.
Please notice changes made to class have been retrieved from org to Visual Studio
Terminal shows the output
PPT for Salesforce DX for Non-Scratch Orgs
Together we can learn faster
Join LWC study group on Telegram
Subscribe to Youtube channel and blog to get latest updates
Reference
Project Development Model Trailhead