Skip to content
Salesforce CLI Unification Drives Devops

Salesforce CLI Unification Drives Devops

The recent unification of the Salesforce CLI represents a milestone for developers building on the Salesforce platform. By consolidating tools, Salesforce aims to streamline workflows and accelerate innovation. This shift spotlights the critical role of the CLI in enabling productivity and efficiency gains through automated and optimized processes.

For Salesforce professionals, the CLI powers everything from retrieving data to deploying updates with ease. The command-line interface minimizes manual tasks, while maximizing control and customization for working with complex Salesforce architectures. Whether used daily or occasionally, the CLI has become an indispensable part of the developer toolkit.

The consolidation of Salesforce DX and Salesforce CLI into a single toolkit signals a commitment to enhancing the developer experience. It underscores CLI鈥檚 essential position in an evolving Salesforce DevOps ecosystem dedicated to frictionless application lifecycle management.

馃挕 Insight:

A Command Line Interface (CLI) is a way to control software using text commands, unlike the graphical interfaces we use for most applications. To use a CLI, you open a terminal window where you can type your commands. On Windows, this program is called Windows Terminal, and on Mac, it’s simply known as Terminal. This method is great for quickly executing tasks without the need for navigating through menus and buttons. So, you put instructions and commands directly in the App.

What Is Salesforce CLI Unification?

The Salesforce CLI Unification project is Salesforce’s strategic move to enhance the developer experience by streamlining the command-line interface (CLI). Rolled out in late 2022, this initiative aims to consolidate all Salesforce CLI tools and commands into one cohesive and unified system. By doing so, Salesforce intends to simplify the development process on its platform, making it easier and more intuitive for developers to navigate. This consolidation is designed to lower the learning curve for new users and increase efficiency for seasoned developers, ultimately leading to greater productivity in building and managing Salesforce applications.

Transition from SFDX to SF CLI: A Closer Look

The transition from Salesforce DX (SFDX) to Salesforce CLI (SF CLI) was driven by the need to offer a more integrated and unified tooling experience for Salesforce developers. Key changes include a more intuitive command syntax, enhanced support for CI/CD pipelines, and improved compatibility with Salesforce’s ever-expanding suite of products and services. The benefits of this transition are manifold, including increased developer productivity, streamlined processes, and a more robust and flexible development environment. If you would like to learn more about SFDX, and commands that were deprecated, you can visit Salesforce SFDX, and first that you will see, it will be information that SFDX has been deprecated.

Image Source:  Salesforce SFDX

Salesforce has stated that starting with the Spring ’24 release, they will remove the old set of commands. While the old commands appear to be safe for now, developers are advised to switch to the new, unified commands as soon as possible. This change is important to avoid any disruption in the functioning of Salesforce CLI in existing CI/CD scripts, shell scripts, and Makefiles.

Understanding the Key Differences

Switching from the old sfdx-style commands to the new, sleek sf-style is pretty much a breeze for most tasks. Though, in a few spots, you might need to roll up your sleeves and do a bit of extra work. Why the change, you ask? Well, Salesforce decided it was time to make things a whole lot simpler for us. As an example, instead of 6 deprecated force commands:

  • force:source:push
  • force:source:pull
  • force:source:deploy
  • force:source:retrieve
  • force:mdapi:deploy
  • force:mdapi:retrieve

You have to use two new sf-style commands, such as project deploy start and project retrieve start

Additionally, the update introduces specific commands for managing metadata more efficiently. For example, to deploy metadata, you can now use a command like sf deploy metadata. This addition provides more direct and clear commands for common tasks involving metadata.

Another significant improvement is the interactive nature of the new commands. When you initiate a command such as sf deploy, the CLI now offers prompts and guidance throughout the process. This interactive approach helps ensure you’re entering the correct information and options, reducing errors and making the CLI more user-friendly, especially for those new to Salesforce development.

Also, you can map old SFDX commands, that you are used daily, with new SF(v2) commands:

sf-style CommandEquivalent sfdx-style Command
project retrieve startforce:source:retrieve
project retrieve previewforce:source:status
project retrieve startforce:source:pull
project deploy startforce:source:push
project deploy startforce:source:deploy
project delete sourceforce:source:delete
Source: Salesforce

More commands mapping can be found in the Salesforce CLI Command Reference

In addition to introducing the commands project deploy start and project retrieve start, Salesforce has expanded the Salesforce CLI’s functionality with the addition of several commands and flags designed to enhance user experience and usability in a professional context.

New Project Commands

One notable enhancement is the project deploy preview command, which facilitates a preliminary assessment of deployment processes. This command generates a detailed table that illustrates the expected outcomes of executing the project deploy start command, providing comprehensive insights into the metadata components slated for deployment or deletion, identifying potential conflicts between the project and the Salesforce organization, and delineating files excluded from deployment due to their inclusion in the .forceignore file. Furthermore, the project retrieve preview command offers similar functionality for retrieval operations, enabling users to foresee the results of extracting data from their Salesforce organization.

Can you be able to validate first? And the answer is yes! Check if your deployment will work and then deploy it later using two commands: project deploy validate and project deploy quick.

First, use project deploy validate to see if your deployment will be successful without actually sending your metadata to your org. It’s a lot like a project deployment start, but with this, you’re also required to run Apex tests. Instead of kicking off the deployment, you’ll get a job ID. If everything checks out, you then use this job ID with project deploy quick to actually deploy your metadata. The cool part? This deployment method is quicker because it bypasses the Apex tests, saving you time.

These improvements underscore Salesforce’s commitment to refining the CLI’s functionality, prioritizing transparency and efficiency in deployment and retrieval operations, thus supporting a more streamlined workflow for Salesforce developers and administrators within the Salesforce ecosystem.

The Salesforce CLI is a crucial tool for automating development tasks, playing an important role in the DevOps framework, particularly in continuous integration and deployment within the Salesforce ecosystem. It enhances efficiency by automating repetitive tasks, leading to faster and more reliable delivery of updates.

Salesforce CLI and CI/CD

Major part of Salesforce professionals are adopting or planning to introduce CI/CD workflows, which streamline operations, reduce errors, and improve the overall quality of deployments. Key tools like Gearset or Jenkins facilitate these processes, integrating directly with Salesforce to manage version control and automate testing and deployment tasks.

The selection of CI/CD tools includes both Salesforce-specific options and general automation tools such as CircleCI, Jenkins, and GitHub Actions. This variety offers flexibility in setting up CI/CD pipelines that best fit project requirements. Salesforce CLI, in particular, aids in creating scratch orgs for testing, ensuring changes are validated in a controlled environment before deployment.

Setting up a CI/CD pipeline involves steps like configuring version control with Git, setting up environments for development and testing, and automating deployments through platforms like GitLab. This process ensures continuous integration and deployment, facilitating a more dynamic and efficient development workflow.

In essence, Salesforce CLI and CI/CD practices offer a streamlined approach to Salesforce development, enabling teams to deliver high-quality work quickly and reliably. As Salesforce continues to evolve, these tools and methodologies will remain essential for developers navigating the platform’s complexities.

Final Thoughts

The unification of the Salesforce CLI, also known as sf vs sfdx, into a single, cohesive toolset simplifies the development experience, making it more intuitive and accessible for developers of all skill levels. This evolution is not just about enhancing the tooling experience but also about fostering a more robust, agile, and collaborative development environment.

Furthermore, the Salesforce CLI plays a pivotal role in automating deployment and testing, supporting source-driven development, facilitating bulk data operations, and integrating with CI/CD pipelines. This automation and integration capability significantly enhance the development workflow, reduce manual errors, and increase productivity.

Incorporating these strategies and tools into the Salesforce development process underscores a commitment to quality, efficiency, and innovation. As Salesforce continues to evolve, these practices and tools will undoubtedly continue to shape the landscape of Salesforce development, making it more agile, reliable, and aligned with the ever-changing needs of businesses and developers alike.

Apply Filters