Get Started with Salesforce DX !
What is Salesforce DX?
Salesforce is a modern developer experience that will change the way you manage and develop Salesforce apps across the entire lifecycle.
Whether you’re an individual developer or working as part of a large team, Salesforce DX provides you a set of commands (CLI) and a new environment (Scratch org) to setup a high-performance agile development.
Best of all, we’ve built it to be open, flexible and extensible so you can build the way you want with the tools and practices you know and love.
With a focus on source-driven development, Salesforce DX makes it easier for developers to build together and continuously deliver using the tools that make them most productive.
Salesforce DX was built upon these core principles:
- Source code drives everything. So the SCM is the source of truth.
- Metadata and code are modular.
- Environments are easily created and disposable (Scratch orgs).
- Development is organized around team collaboration.
- Use any favorite IDE or any SCM
- Flexible packaging supports agile distribution model (Packaging 2).
- Processes and tools facilitate continuous integration and continuous delivery.
Salesforce DX Highlights:
- Developer Hub (Dev Hub Org)
The Dev Hub org allows you to create, delete, and manage your Salesforce scratch orgs. After you setup your project on your local machine, you authorize the Dev Hub org before you can create a scratch org.
The actual supported editions for Dev Hub orgs are Enterprise Edition (EE) and Unlimited Edition (UE).
- Scratch orgs:
A scratch org is your own personal development environment: a source-driven and disposable runtime for Salesforce code and metadata. A scratch org is fully configurable, so developers can emulate different Org shapes (editions, features, preferences, permissions, etc.)
Developers can also populate scratch orgs with sample data.
To get started creating scratch orgs, choose any paid org to function as your Dev Hub. If you want to try Dev Hub and experiment outside of your production org, sign up for a Dev Hub trial org. Dev Hub trial orgs expire after 30 days, but that gives you plenty of time to complete the Get Started with Salesforce DX trail.
You can specify the scratch org’s duration, which indicates when a scratch org expires. By default, a scratch org expires in 7 days.
Scratch Org Allocation Information:
You can run the command:
sfdx force:limits:api:display -u
to list how many scratch orgs you have allocated and how many you have remaining.
By default, a scratch org is empty. However, if you prefer to create a scratch org with the sample data and metadata typically included when you sign up for an org, no problem. Just add the hasSampleData option in the scratch org definition file.
- Second-Generation Packaging (Packaging 2)
We’ve been re-imagining packaging and actively working on how it should work in Salesforce DX. This Pilot of Packaging 2 gives you a chance to see where we’re going.
Packaging 2 adds several exciting options to Salesforce DX:
- Better organize your source and more easily share Apex code by defining multiple packages within a single namespace. This lets you use public Apex classes to share code across packages rather than using global Apex classes.
- Implement feature branch development and testing.
- Multiple packages per namespace, so you can better organize your source and easily share Apex code. You can use public Apex
- classes across packages rather than global Apex classes.
- Fully API-driven functionality
- Develop packages that are source-driven, not org-based.
- Easily develop and distribute dependent packages.
What Salesforce DX isn’t?
Salesforce DX is Generally available (GA) , so it’s not a finished product and it doesn’t support all metadata types and org features.
Salesforce DX is not a CI or CD tools, you should integrate your favorite CI/CD tools by writing some scripts to call sfdx commands and authorize to your Dev Hub environnement. The CI/CD tools will be most accessible and useful for members of your Salesforce team.
Salesforce DX is not a magic bullet that will resolve your dependency issue and manage releases. Project should be splitted into multiple artifacts.
Salesforce DX is a game-changer for Salesforce developers. Metadata in project driven by Salesforce DX and VCS should be organized into “Artifacts”. You should evaluate all aspects of your development process to look for possible ways to shift to the modular artifact-based approach.
Developers should follow this idea of isolating a set of source and metadata into a single artifact.
Salesforce DX is a first step to move forward to a modern application development, particularly in the area of Continuous integration and Continuous Delivery.