Menu

Salesforce DX Platform Development

Salesforce DX is a new integrated experience designed for high-performance, end-to-end agile Salesforce development that is both open and flexible.

Before Salesforce DX, all custom objects and object translations were stored in one large Metadata API source file.

Salesforce DX solves this problem by providing a new source shape that breaks down these large source files to make them more digestible and easier to manage with a version control system.

A Salesforce DX project stores custom objects and custom object translations in intuitive subdirectories. This source structure makes it much easier to find what you want to change or update. Once you have developed and tested your code you can then convert the format of your source so that it’s readable by the Metadata API, package it and deploy it.

This is a complete shift from from monolithic, org-based development to modular, artifact-based development while also enabling continuous integration (CI) and continuous delivery (CD). This means development teams can develop separately and build toward a release of the artifact, and not a release of updates to the org.

This will be a working post as I continue to go through the release notes and work with the new platform tools.

Package directories indicate which directories to target when syncing source to and from the scratch org. Important: Register the namespace with Salesforce and then connect the org with the registered namespace to the Dev Hub org.

Creating your VCS Repo

You can now initiate a git repo and connect it to bitbucket or github.

The Scratch Org

You can have

50 scratch orgs per day per Dev Hub

25 active scratch orgs,

They are deleted after 7 days

The scratch org is a source-driven and disposable deployment of Salesforce code and metadata. A scratch org is fully configurable, allowing developers to emulate different Salesforce editions with different features and preferences. And you can share the scratch org configuration file with other team members, so you all have the same basic org in which to do your development.

The project.json file is what makes the project and scratch org configurable. You can now define what type of org, permissions and settings you want to build and test in. It is a way to build and test with certain platform features, application settings and circumstances while also being able to version and have source control.

This also enables continuous integration because you can test against a use case in one of the scratch orgs and see the impact based on the configuration or by importing data from the source org. Once bulkified and tested it can be pushed back into the source org.

Scratch orgs drive developer productivity and collaboration during the development process, and facilitate automated testing and continuous integration.

Use many scratch org config files – name them . They are the blueprint for the org shape.

Installing a package

(use a bitcoin/ethereum/token address as the package installation key)

Check to see if has paid and if it has, it installs.

Push and Pull

sfdx force:source:push

This is used to push data from your project to a scratch org

It will push the source code to the scratch org you have set as the default, or you can specify an org other than the default by using

–targetusername

-u

.forceignore – Any source file or directory that begins with a “dot,” such as .DS_Store or .sfdx, is excluded by default.

sfdx force:source:pull

This is used to pull data from your scratch org to your project

Setting Aliases

sfdx force:alias:set org1= name org2= name2

To remove an alias, set it to nothing.

sfdx force:alias:set my-org=

Listing your Orgs

sfdx force:org:list

(D) points to the default Dev hub username

(U) points to the default scratch org username

Retrieving and Converting Source from a Managed Package

Working with Metadata has usually required a tool like ANT. Now you can retrieve unmanaged and managed packages into your Salesforce DX project. This is ideal if you have a managed package in a packaging org. You can retrieve that package, unzip it to your local project, and then convert it to Salesforce DX format, all from the CLI.

Essentially you can take your existing package and re shape it into a Salesforce DX Project format