Follow and complete a Learn MOAR Winter ’21 for Admins or Developers trailmix by October 30 to earn a special community badge and enter for a chance to win one $200 USD Trailhead Cert voucher.

An introduction

Salesforce DX provides a wealth of tools to build quality applications rapidly. The Salesforce DX toolset includes Salesforce CLI and Salesforce Extensions for VS Code to help developers at every point in the development process. This post covers what’s new in both Salesforce CLI and Salesforce Extensions for VS Code.

Since the developer tools have a weekly release cadence, most of the features covered in this post are already available with the latest update. You can start using these features right away. To try commands that are part of the upcoming Winter ’21 Release (API Version 50), you can install the prerelease version of the CLI . Don’t forget to switch back to the GA version once you’re done experimenting. You can find the instructions for switching back and forth between prerelease and GA versions in the release notes.

Salesforce CLI

Let’s start with updates to the Salesforce CLI:

Config commands are now in their own namespace

As a part of the effort to the move towards open-sourcing Salesforce CLI, the source for config commands has now been moved to its own GitHub repo. The commands are now in the config namespace, and not in the force namespace. The force version of the commands will be deprecated in the future, though you can still use it. Let’s compare the force namespace commands with the newer, shorter config namespace commands.

Old Command New Command
$ sfdx force:config:list $ sfdx config:list
$ sfdx force:config:set apiVersion=50.0 $ sfdx config:set apiVersion=50.0
$ sfdx force:config:get apiVersion=50.0 $ sfdx config:get apiVersion
$ sfdx config:unset apiVersion

A new command, config:unset, has been added to unset a config value.

Customize your Salesforce CLI command with hooks

Have you ever wondered how to customize the behavior of Salesforce CLI commands? You can create a hook to customize some of the CLI commands.

A hook is a piece of code that runs at a specific lifecycle event during command execution. The command execution pauses while the hook code executes and then resumes when the hook code execution is completed. For example, you can create a hook for force:source:push to post a notification or display a custom error message when metadata types fail to deploy in the organization. To implement this, you’d create a hook that triggers during the Salesforce CLI lifecycle event postdeploy. Here is a list of Salesforce CLI lifecycle events and when they are fired:

  • predeploy – After the CLI has converted your source files to Metadata API format but before it sends the files to the organization.
  • postdeploy – After the CLI has sent the metadata to the organization and the organization has sent back a confirmation.
  • preretrieve – Before the CLI sends a request to the organization to fetch files.
  • postretrieve – After the CLI has retrieved the metadata from the organization. The metadata has not yet been converted to source format.
  • postsourceupdate – After the CLI has converted the files it fetched from the organization to source format.
  • postorgcreate – Immediately after a new scratch organization or sandbox is created. You can access the organization from the hook.

Salesforce also supports all the oclif hooks. You can learn more about hooks in the Salesforce CLI Plug-In Developer Guide.

Stretch your query limit

You can increase the number of Salesforce records that a CLI command returns with the new maxQueryLimit configuration value. The default value is 10,000.

For example, let’s say you run sfdx force:mdapi:listmetadata -m Role on a Salesforce organization that has 15,000 roles. By default, the command displays only 10,000 roles along with a message warning you that the command retrieved only some of the roles. In this case, you can set the value to 20,000 to retrieve all records.

sfdx force:config:set maxQueryLimit=20000

Salesforce Extensions for Visual Studio Code

Now let’s take a look at the new Salesforce Extensions for VS Code capabilities.

SLDS Validator

The SLDS Validator extension helps you identify Salesforce Lightning Design System related issues in your HTML, CSS, and JavaScript code and provides smart suggestions. SLDS Validator is now shipped as part of the Salesforce Extension Pack. You can use it to make your code more maintainable, more adaptable, and less likely to break with Salesforce Lightning Design System updates.

Mobile preview of Lightning Web Components

The Local Development Server (Beta) plug-in enables you to preview changes to your Lightning web components locally without publishing the components to an organization. You can now use a new feature to see a list of available or compatible devices via the LWC preview command.

To preview your components on iOS or Android emulators you must set up Xcode or Android Studio respectively. Once that is done, right-click a component in the explorer, as shown below, and select SFDX: Preview Component Locally. This opens the Command Palette, which shows a list of devices capable of previewing the component. Pick a device from the list and preview the component in it. You can also preview changes to the component dynamically as you work on it.

Salesforce Extensions - preview component on a selected device

Create faster

We rearchitected create commands to reference the template repository directly. As a result, the create commands are faster than ever. Not only that, you can create a project, Apex Class, LWC component, or anything else your heart desires without the CLI setup. This lets you start coding with less upfront work. You will still need the CLI for other operations, but you can tackle that step a bit later in the process.

Deploy and retrieve faster

We’ve made significant updates to our Deploy and Retrieve commands. There aren’t any functional differences, but you should notice much better performance — especially if you use Windows. These changes are currently in beta within VS Code. With a quick toggle of a setting, you can try it out next time you want to deploy or retrieve.

Community contributions

Huge shout-out to the community for continued engagement and contributions! Here’s some of the awesomeness you have added recently:

Extension Updates

Documentation Updates


Now you’re up-to-date with some of the key tooling updates for this release. Keep in mind though, that both CLI and Salesforce Extensions for VS Code release new features every week, so here are two ways you can stay current:

  • Check for new and changed CLI features with the weekly updates in the Salesforce CLI release notes. You can keep up with the incremental changes by running a simple sfdx command: sfdx update.
  • Stay up-to-date with the latest features on Salesforce Extensions for VS Code just by clicking the update button of Salesforce Extension Pack. You can check for new and changed features at any time by visiting Salesforce Extension Pack change log.

Happy coding.


#LearnMOAR and share

Share what you love about the Winter ’21 Release with the #LearnMOAR hashtag. Also, don’t forget to sign up for Release Readiness Live happening on September 18, 2020.

About the author

Satya Sekhar is a Senior Developer Evangelist at Salesforce, focusing on Lightning Web Components and developer tools. He is passionate about sharing his knowledge about all that is possible with the Salesforce Platform with various audiences in an understandable format.

No purchase necessary. Void where prohibited. Sweepstakes runs from September 14, 2020 12:00 PM PT to October 30, 2020 11:59 PM PT. Open to legal residents of the U.S. (incl. D.C.), Austria, Canada (excluding Quebec), Cyprus, France, Germany, Greece, Hungary, India, Ireland, Japan, Lithuania, Latvia, Luxembourg, Netherlands, New Zealand, Norway,
Spain, Switzerland, Ukraine, and the U.K. Must be 18+ (20+ in Japan). See Official Rules.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS