Setting Up Salesforce DX

Setting Up Salesforce DX

Salesforce DX is a Salesforce product in the App cloud that allows users to develop and manage Salesforce apps throughout the entire platform more directly and efficiently. It is used primarily by developers.

Before we start, off with salesforce dx we need to ensure that we have a few initial requirements.

System Requirements

  • Windows—Windows 7 (64-bit and 32-bit) or later
  • Mac—macOS 10.11 or later
  • Linux—Ubuntu 14.0.4

Code Editor or IDE

You can use any code editor, including Salesforce Extensions for VS Code.

Developer Hub

The first thing we need to do is enable the Developer Hub (Dev Hub). So you might be thinking what is the Dev Hub? Dev Hub allows for the development and management of scratch orgs. The scratch org is a source-driven and disposable release, designed for developers and automation, of Salesforce code and metadata. Scratch orgs are a central feature of Salesforce DX, an open development environment designed to create and manage Salesforce applications during their lifecycle.

Enabling Dev Hub in a production or business org is completely safe and won’t cause any performance or customer issues. Dev Hub comprises objects with permissions that allow admins to control the level of access available to a user and an org.

To enable Dev Hub in an org:

1. Log in as System Administrator to your Developer Edition, trial, or production org (if you’re a customer), or your business org (if you’re an ISV) and navigate to your org setup

No alt text provided for this image

2. From Setup, enter  in the Quick Find box and select Dev Hub.

  • Dev Hub

If you don't see Dev Hub in the Setup menu, make sure your org is one of the supported editions.

No alt text provided for this image

3. To enable Dev Hub, click Enable.

After you enable Dev Hub, you can’t disable it.

No alt text provided for this image

Second-Generation Managed Packaging

Next thing we need to enable Second-Generation Managed Packaging (2GP). 2GP is new way for AppExchange partners to develop, distribute, and manage their apps and metadata.

You can use 2GP to

  • organise your source,
  • build small modular packages,
  • integrate with your version control system,
  • better utilise your custom Apex code.

With 2GP enabling version control, there are no packaging or patch orgs. You can execute all packaging operations via Salesforce CLI, and automate them using scripts.

Because we have already enabled Dev Hub in our last section, enabling 2GP is a piece of cake!

1. On the Dev Hub Page in setup press "Enable Unlocked Packages and Second-Generation Managed Packages".

No alt text provided for this image

Enable Einstein Features (Optional)

This step is optional and only for those who are already playing about with Einstein. Turning on Einstein features in your Dev Hub to eliminate the manual steps in scratch orgs to enable the Chatbot feature.

1. On the Dev Hub Page in setup press "Enable Unlocked Packages and Second-Generation Managed Packages"

No alt text provided for this image

Installing the salesforce CLI

Now that we have finished with most of the brute-force work within your salesforce org we can now get onto the more interesting side of this.

So what is this "Salesforce CLI"? For those people who are not familiar with the term CLI, it stands for the command-line interface.A CLI is a text-based user interface (UI) used to view and manage computer files. With the Salesforce CLI, it provides some shortcut commands to be able to easily

  • Create environments for development and testing
  • Synchronise source code between your
  • Scratch orgs
  • Version control system,
  • Execute test suites.

This tool in my opinion is one fo the best things to ever happen to the salesforce eco-system.

In this article I am only going to go through installing on macOS and Windows as they are the 2 most common devices used. You can also install the on Linux and using NPM.

Install the CLI on macOS

You install the Salesforce CLI on macOS with a .pkg file.

  1. Download the .pkg file.
  2. Double-click the .pkg file.

Install the CLI on Windows

You install the Salesforce CLI on Windows with an .exe file.

  1. Download and run the Windows installer.

Verify Your Installation

Verify your Salesforce CLI installation by running a couple commands.

Verify the Salesforce CLI version:

sfdx --version

Verify CLI plug-in

sfdx plugins --core

Ensuring you have the most updated CLI

After installing the CLI, It is recommended that you run to ensure that you have the most up to date version of the CLI.

sfdx update

Thats it! now that you have successfully installed you are ready to start using Salesforce DX, I recommend that you check out the Salesforce CLI Command Reference.

Happy Hacking.


Giordano Stepancic

Founder | Chief Executive Officer at Property Credit

2y

James, thanks for sharing!

Like
Reply

To view or add a comment, sign in

More articles by James Dinnes

Insights from the community

Others also viewed

Explore topics