Salesforce DX for Non-Scratch Org

In this session, we talk about how to set up the Salesforce Dx for non-scratch org and talk about Scratch Org VS Sandbox Development.

YouTube video

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:
    • businessProcesses
    • compactLayouts
    • fields
    • fieldSets
    • listViews
    • recordTypes
    • sharingReasons
    • validationRules
    • webLinks
  • 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

Scratch Org VS Sandbox Change Set Based Development

Winter 19 Salesforce Source Commands (Retrieve, Deploy and Delete)

Retrieve Commands

$ sfdx force:source:retrieve -x path/to/package.xml
$ sfdx force:source:retrieve -m CustomObject,ApexClass

Deploy Commands

$ sfdx force:source:deploy -x path/to/package.xml
$ sfdx force:source:deploy -m ApexClass:MyApexClass

Setup Salesforce DX for Non-Scratch Org

Step 1) Setup your System.

  1. Install Salesforce CLI (SFDX).
  2. Install VSCode and Check this post to learn about Vs code
  3. 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.

Step 2) Create a project

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

Retrieve 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.

Deploy changes in Org

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

Summary

Join/Subscribe to our YouTube channel, “Salesforce Apex Hours” for more recordings. Join our Trailblazer Community for all future event details.

Amit Chaudhary
Amit Chaudhary

Amit Chaudhary is Salesforce Application & System Architect and working on Salesforce Platform since 2010. He is Salesforce MVP since 2017 and have 17 Salesforce Certificates.

He is a active blogger and founder of Apex Hours.

Articles: 461

Leave a Reply

Your email address will not be published. Required fields are marked *