Salesforce DX: Change the Way You Work

Developers have been throwing around this term “Salesforce DX” for some time now, but what does it mean? Salesforce DX stands for Salesforce Developer Experience and is a product from Salesforce that allows developers to create and manage Salesforce apps and features in a more direct and efficient way. It brings the best features from the lightning platform to allow for more source-driven team collaboration on custom app development in Salesforce.

Within this article, we are going to be taking a look at some of the key features that really highlight how Salesforce DX is made for developers. Why you should be using Salesforce DX to develop if you’re not already. _____

Feature #1: Visual Studio with Salesforce CLI

Salesforce DX

If you’re a developer, then chances are you’ve probably written in multiple code languages. Languages such as Python, JavaScript, C++, and Swift offer unique and sometimes challenging methods to basically achieve the same thing. While they are all different, they also have one thing in common, a pretty good IDE to go with them.

If you’re new to development, or Apex is your first experience writing code, then it’s totally normal to not know what an IDE is. An IDE stands for an integrated development environment, basically a program with a unique set of tools that helps programmers develop code faster and with fewer errors. Java has Eclipse, Swift has Xcode, and Apex now has Visual Studio.

Studio with Salesforce CLI

Visual Studio with Salesforce CLI (command-line interface) is an IDE for developers to manage and create apps designed for salesforce, directly from within Microsoft Visual Studio. Visual Studio allows for team collaborative, source-driven development (through GitHub), and a slick command-line interface that removes the complexity of the Salesforce UI.

If you have ever used the developer console before, then you have already had your hands on a CLI. But as we know, the developer console doesn’t contain all the neat debugging tools of an IDE such as Visual Studio, and is only accessible from within a Salesforce org. Installing the Salesforce CLI into Visual Studio allows for that same developer console feel without the salesforce org to go with it.

If you’re already using Microsoft Visual Studio and would like to download the Salesforce CLI to begin programming in apex, here is the link.

_____

Feature #2: Scratch Orgs

Developing and writing apex code in Salesforce is such a long process. There are several reasons for that, but one of the most glaring is setting up a sandbox org. Not only does it take a long time to create, but there are limits to the number of sandboxes you can have and if you hit that limit, you have to start refreshing them. With Salesforce DX, this problem is virtually eliminated.

Scratch orgs

Scratch orgs are Salesforce DX’s version of sandbox and development orgs. With scratch orgs, developers can quickly spin up an org without needing to log in. These organizations are perfect for developers when we want to:

– start or branch a project – develop a new feature – automate testing – start from “Scratch” with a new org

It is important to note that there is a limit to the number of scratch orgs you’re allowed to create, and that depends upon your salesforce organization level. Here are the scratch org limits for your consideration:

Edition Active Scratch Org Allocation Daily Scratch Org Allocation Developer Edition or trial 3 6 Enterprise Edition 40 80 Unlimited Edition 100 200 Performance Edition 100 200

As you can see, while there is a limit to the amount of scratch orgs you can have at one time, you’re able to create and monitor a vastly greater number of scratch orgs and of sandboxes. How efficient and easy it is to spin these up, clear that scratch orgs are the winner for developers.

Read more about scratch orgs , trail head has a wonderful unit on them that can be found at this link here. _____

Feature #3: Source-Driven Development

Salesforce DX

The online forum is a wonderful community of developers sharing and writing code for each other. Developers will post code for an app so that other developers can piggy-back, or branch, off an existing starting point. This is where Salesforce DX’s source-driven development features come into play.

With Salesforce DX’s ability to connect to code repositories GitHub, it becomes very easy to find already written code. Which serves as a great starting point and only put in the work to tailor it to your specific organization. This severely cuts down on development costs, as developing from scratch takes way more time. Manpower to get from nothing to a fully functioning app.

With source-driven deployment, the only scratch you’ll be concerned about is how fast you can get that scratch org spun up to start testing new source code. (which will still happen a lot faster than creating a developer org from within Salesforce).

_____

Feature #4: Version Governance

We’ve talked a little bit about how Salesforce DX, with its ability to provide source-driven development through GitHub, can help jumpstart the development process by providing source code from a repository. Clever developers will also realize that you can use feature three to also gain version governance over your development process.

In other words, For those new to development who are probably asking “what is version governance?”, we’ve got you covered. Version governance is the process of keeping track of changes throughout the development life cycle. With proper version governance, a developer is able to organize changes made by team-members. Can access previous versions of the developing app relatively easily. This is extremely important when working with a large application containing many collaborators. If code is not working, lead developer needs to know who authored the code in order to get it fixed.

Salesforce DX

Version governance also serves as an amazing tool to protect against accidental code deletion. As code is written, developers push the new or changed code to the newest version and those changes are recorded. If a developer accidentally deletes code they were working on, then that code can easily be recovered.

Similarly this is entirely dependent upon developers pushing updated code into the repository though, so make sure your team is doing this regularly. Code that is not push into the repository does not fall into a version, and therefore can’t be recovered.

Conclusion

However the four features are not the only reasons to develop with the Salesforce DX platform, but they are certainly some of the heavy hitters. If this article whetted your appetite Salesforce DX information, check out the Salesforce DX Developer Guide here. While the developer guide goes over some more neat features such as metadata coverage, unlocked packages, and continuous integration. If you’re seriously looking at using the Salesforce DX platform for development, it is a must-read.

Next Steps