Salesforce DX: The road to agile development

Posted On by Robin Weymans

In 2017, Salesforce released an alternative way to develop on the Force.com platform, called Salesforce DX. The goal is to make developing on Force.com more aligned with local developing. In a nutshell, it allows developers to create apps locally and quickly push them to a temporary org, called scratch org, for testing purposes. If everything works as expected, the app can be packaged so that it can be installed on any org through the AppExchange.

While DX has been around for quite some time now, most of our customers are still developing on their Force.com platform in a traditional way. This implies they miss out on many of the advantages of Salesforce DX. Let me tell you a little story about Alice, Bob and Charlie, three developers working on different features in the same org.

The traditional way

Knipsel

Before Alice, Bob and Charlie can start developing, code needs to be downloaded, or pulled, from the org. The fact that every developer is downloading from the same org makes it the single source of truth. Let’s say Bob made a change and pushed his new code to the org. Now Alice and Charlie have an outdated version of the codebase, without even knowing it! But that’s not all. What if Bob made some errors in his code, and pushed that to the org? Now every developer that’s testing his own code suddenly sees errors popping up everywhere. Things can get out of hand very quickly.

Now, what if Alice or Charlie also made changes based on their outdated local codebase and pushed those alterations to the org? Yep, you guessed it… all of Bob’s hard coding work is overwritten. Woops. Alice, Bob and Charlie solve this issue right away by letting each other know when they pushed new code. This way they can refresh their local codebase so nothing gets overwritten. That doesn’t sound very efficient, now does it?

And then there was DX

Knipsel

It all starts by removing the Salesforce org as the source of truth and replacing it with GitHub, Bitbucket, or another Version Control System (VCS). Something that is already used by many developers. Alice, Bob and Charlie can now pull the codebase from the repository and work on their own features. This is where DX comes in. Salesforce DX can quickly create a new disposable org, called scratch org, and push the developers code in. The developer can test if his code is working as expected and if he perhaps wrote faulty code, no other developer will be affected. He can even make some declarative changes like adding a custom object, adding a field or making a process builder and let DX pull those changes back into his local codebase.

When Alice, Bob or Charlie have finished coding their feature, they upload their code to the online repository. It’s still possible that there are conflicts, for example when they worked in the same files. Instead of overwriting, the developer now simply is given the option to resolve the conflict.

The only thing left to do for Alice, Bob and Charlie is let Salesforce DX package all the code in the online repository. DX will give them a link so that they can install the package on any org they want.

DX for Salesforce admins

In the example above, I only talked about developers. DX is not only there to aid developers, but also for functional Salesforce admins that do all the point-and-click configuration. I asked the functional consultants at 4C what they dislike the most about configuring in Salesforce and I unanimously received the following answer: deploying.

A Salesforce admin that wants to propagate configuration changes from one org to another needs to make a change set. Therefore, he needs to go through the hassle of finding every component that was changed, add all these components to the change set and send the change set to the destination org. After ten minutes of waiting, the change set arrives. The next step is to verify the change set, which takes another five minutes. If all goes well, we can deploy the change set, but … we forgot to add one field. Back to square one. If only they knew about Salesforce DX.

Also interested in learning how Salesforce DX can ease development and deployment in your Salesforce org? We can get your Salesforce developers and admins up to speed by providing a Salesforce DX training, just contact us!