img1

What is deployment?

A Deployment includes all the processes required for preparing a software application to run and operate in a specific environment. It involves installation, configuration, testing and making changes to optimize the performance of the software. It can either be carried out manually or through automated systems. In today’s article, different tools and techniques will be discussed to deploy your changes on the Salesforce Platform. Salesforce Deployment is nothing but copying/transferring Salesforce metadata from one Salesforce organization to another. There are various methods to achieve Salesforce metadata deployment. Specific instructions won’t be given on how to set up each of the following deployment options, such descriptions can be found on the Salesforce help articles, instead, this article will be mainly centered around high-level descriptions for the available deployment options in Salesforce.

Deployment Options

  • Deployment Using Salesforce Extensions for Visual Studio Code
  • Deployment Using SOAP API
  • Deployment Using the ANT Migration Tool
  • Deployment Using Change Sets

Deploy Using Change Sets

The easiest way to send configuration changes from one Salesforce organization to another is to use a change set though it has a limitation that we can use it among connected Salesforce organizations only. Using Change Sets, you can deploy workflows, rules, Apex classes and triggers, and other customization from a sandbox org to another connected org. Change Sets can either be Inbound or Outbound. >Outbound Change Sets, contain metadata information to be deployed to a connected org. >Inbound Change Sets, contain metadata information that can be accepted or rejected from an incoming outbound change set. Note: Sending a change set between two organizations requires a deployment connection.

Caveats with Change Sets

  • Manual and slow, change sets are highly manual. You have to remember what has changed and all dependencies between them. For example deploying object permissions for a changed profile, wont work properly without adding the associated objects.
  • Error-Prone, because of the aforementioned manual intervention using change sets, the more changes for each deployment there are, the more easy it is to miss the required components.
  • Change Tracking, A change set simply performs a fresh rewrite of your Salesforce metadata. There is no concept of history or differential changes. This means that a change set can easily wipe out months of work.
  • Rollback on Failure, change sets metadata once validated and deployed cannot be rolled back.
  • Partial deployment, the bigger a change set gets the more dependencies are required, for example, change sets are not a good option for permission sets and profiles, mainly because permissions are tied to other metadata such as tabs, objects ,apps, visual force pages and apex classes the list goes on.

You can’t deploy a profile by itself via change sets. Doing so would render the profile completely useless in a new org. This is because things like field level security, object-level security, VisualForce page access, and Apex Class access requires those elements to be included in the change set. You’ll need to either add all of the elements in your org to ensure that no permissions are missed, or use the Force.com IDE to fully retrieve the profile so you can deploy it.

Deployment Status

You can monitor deployments that are in progress, check which deployments are waiting for execution, and view the results of completed deployments on the Deployment Status page.

Force.com Migration Tool

The ANT Migration Tool is a Java/ANT-based command-line utility for moving metadata between a local directory and a Salesforce org. Salesforce developers typically turn to the Force.com migration tool when they are looking to create a more automated deployment schedule. Change sets, though useful, can be slow and manual. Utilizing this tool, provides the access to the Salesforce metadata API indirectly to move Apex and configuration changes between Orgs, it allows you to interact with the metadata API from the command line without having to dig into nitty-gritty of SOAP scripts. Before you can use the Ant Migration Tool, Java and Ant must be installed and configured correctly.

Benefits Force.com Migration Tool

  • Scheduling batch deployments - it is possible to schedule deployments or schedule metadata retrieval.
  • The approach to deployment is scripted and repeatable, hence consistency.
  • Multistage release processes, typical development process requires iterative building, testing, and staging before releasing to a production environment. Scripted retrieval and deployment of components can make this process much more efficient.
  • A seeded environment with test data is easier than using a web application.
  • Some components are not supported to be migrated using change sets but you can migrate them using ANT migration tool.

Disbenebits Force.com Migration Tool

  • It relies on the Salesforce metadata API, the tool is not able to deploy all metadata types. and other types are technically supported by the metadata API but which are extremely challenging to deploy in an automated way such as Profiles and Permission Sets.
  • The Force.com migration tool can also be dangerous if it’s not included with version source control tool such as git. This is mainly due to the fact, consistent use of the tool can overwrite previous deployment efforts.
  • As a command-line utility and based on a scripting language, the Force.com migration tool can be intimidating and requires team members to be familiar with Ant and basic JAVA.
  • It requires significant maintenance and setup, the setup aspect was not presented in this article. But a few steps need to be taken on your operating system of choice to get the ANT migration tool to work properly, such environment variables and the actual download of the Force.com tool.

Deploy Using Salesforce Extensions for Visual Studio Code

Salesforce extensions for VS Code are powered by Salesforce CLI and the Salesforce APIs. Together with Visual Studio Code, the Salesforce extension pack provides a robust development environment. Deploy to and retrieve from your sandboxes and other development orgs. Manage, push to, and pull from your scratch org. Write, debug, and refactor your org’s code. The Salesforce CLI is apart of a larger ecosystem, called Salesforce DX a topic we will surely dive rather sooner than later. But in a nutshell for the curious folks out there, with Salesforce DX, you can now benefit from modern collaboration technologies such as Git to version control everything across your team - your code, your org configuration, and your metadata all baked into the CLI. The Salesforce CLI is a powerful command-line interface that simplifies development and builds automation when working with your Salesforce org. Listed below are some of the benefits:

Benefits in using Salesforce CLI

  • Create and install packages
  • Connect to different Salesforce instances
  • Pull and Push changes between different salesforce instances, without a direct connection
  • Version control source changes across different instances
  • Create and manage orgs
  • Create and execute tests on demand
  • Import and export data on demand

Disbenebits in using Salesforce CLI

  • As a command-line utility, it requires some level of learning to get used to, especially if the user is not a developer but an administrator.
  • The CLI exposes a collection of different metadata API’s offering the ability to retrieve and deploy source, however, metadata have different dependencies, those dependencies are retrieved in different ways, therefore you of to be familiar with all the necessary options available.
  • Strong understanding and familiarity with the Metadata API are required to successfully utilize the CLI meaningfully.