In this session we talk about how to setup the SalesforceDx for non-scratch org and talk about Scratch Org VS Sandbox Development.
SalesforceDX source code format difference from traditional format
A Salesforce DX project has a specific project structure and source format. Source format uses a different set of files and file extensions from what you’re accustomed when using Metadata API.
- Object Model : custom objects and custom object translations in intuitive subdirectories. Source format makes it much easier to find what you want to change or update. And you can say goodbye to messy merges.Some parts of the custom objects are extracted into in these subdirectories:
- Static Resources : Static Resources are uncompressed in DX so one can edit it
- Documents : Documents must be inside the directories of their parent document folder. The parent document folder must be in a directory called documents. Each document has a corresponding metadata XML file that you can view with an XML editor.
- Aura Components : Aura bundles and components must reside in a directory named aura under the directory
- Lightning Web Components : Lightning web components must reside in a directory named lwc under the directory
- ExperienceBundle for Lightning Communities : The ExperienceBundle metadata type must reside in a directory named experiences under the directory. The experiences directory contains a folder for each Lightning community in your org. See the Lightning Communities Developer Guide for details.
Scratch Org VS Sandbox Change Set Based Development
Winter 19 Salesforce Source Commands (Retrieve, Deploy and Delete)
$ sfdx force:source:retrieve -x path/to/package.xml
$ sfdx force:source:retrieve -m CustomObject,ApexClass
$ sfdx force:source:deploy -x path/to/package.xml
$ sfdx force:source:deploy -m ApexClass:MyApexClass
Using Salesforce Extensions For VSCode against Non-scratch orgs
Step 1) Setup your System.
- Install Salesforce CLI (SFDX).
- Install VSCode and Check this post to learn about Vs code
- Install Salesforce Extension Pack.
Step 2) Create a project
Click Ctrl +Shift + P and then type SFDX . Then select “SFDX: Create Project with Manifest” option.
After that Enter the project Name and select Folder where you want to save your project
Authenticate your Sandbox/Developer org
Click “CTRL+SHIFT+P” and then select “SFDX: Authorize an Org” and provide Org Alise Name and type of Salesforce org.
or you can execute below command for same if you are using CMD
sfdx force:auth:web:login --setalias MyDevOrg --setdefaultusername
Update your package.xml file
Open Package.xml file from Manifest folder. Then Modify your Package.xml file to add and remove component
Click on Package.xml and select “SFDX: Retrieve This Source from Org” option.
or you can execute below command for same if you are using CMD.
sfdx force:source:retrieve --manifest d:\Amit\MyDevOrg\manifest\package.xml
Deploy changes in Org
Now do your changes in VSCode and then select the file which you want to deploy in your org. Then Right click on VsCode and select “SFDC: Deploy This Source to Org” option for deployment.
you can execute below command for same if you are using CMD
sfdx force:source:deploy --json --loglevel fatal --sourcepath d:\Amit\MyDevOrg\force-app\main\default\classes\AccContExtTest.cls
- Scratch Org VS Sandbox Development
- SalesforceDX source code format difference from traditional format
- Winter 19 Salesforce Source Commands (Retrieve, Deploy and Delete)
- Using Salesforce Extensions For VSCode against Non-scratch orgs
- Auto Generating package.xml from change-sets and un-managed package
- Setting Developer Workflows for Salesforce application development and debugging (ISV apps and changeset based development)
- Deploying metadata from one org to another using Vscode extensions