Developer Tips

The Migration Tool

What is the Salesforce migration tool and how you can achieve continuous integration for Salesforce with Blue Canvas.

March 1, 2017

One of the primary options for Salesforce deployments today is the migration tool, also known as the Ant Migration tool and simply the Salesforce migration tool. The confusion around the name is actually fitting given the confusion around the tool itself. What is the migration tool? What does it do? And can it help me?

The Migration Tool

The migration tool is an alternative to the two other primary Salesforce deployment strategies today: change sets and manually making changes.

Salesforce developers typically turn to the migration tool when they are looking to create a more automated deployment schedule. Change sets, though useful, can be slow and manual. Even slower is actually logging into a production instance and making changes manually.

Many teams are trying to set up a more modern Salesforce deployment schedule. This includes using a Salesforce sandbox strategy that involves making changes in developer sandboxes, migrating them to a staging sandbox for testing and then promoting to production.

The migration tool can help make deployments between environments slightly smoother.

What is it?

The migration tool is a Java/Ant based command line utility that let’s Salesforce developers access the Salesforce metadata API indirectly to move Apex and configuration changes between Orgs.

The Salesforce metadata API is a SOAP API that allows you to push and retrieve some metadata types (see below). Of course, there has been a general movement in software development towards RESTful APIs and most developers no longer particularly enjoy working with SOAP APIs. The migration tool allows you to interact with the metadata API from the command line without having to dig into SOAP scripts.

What is the Salesforce Ant migration tool?

You will often hear the migration tool referred to as the Salesforce Ant migration tool or simply as “Ant scripts”. What is Ant? And are these really the same thing?

Ant is a Java based build tool from Apache. It is independent of Salesforce and can be used to create build steps. Developers familiar with Make files will see some similarities between Ant and Make. Ant was developed to handle some of the existing challenges associated with Unix deploys.

Because Salesforce and Apex are heavily influenced by Java, the migration tool leverages Ant in order to do builds and deployments on the Salesforce platform. So the Ant and migration tools are the same thing, just known by different names.

How to Install the Migration Tool

To use the migration tool you need to have a few things installed: Java and Ant.

Salesforce recommends using Java 1.7.x or later for security reasons. Installing Java is simple and you may already have it installed on your computer. Salesforce also recommends Apache Ant version 1.6 or later.

One these prerequisites are met, simply follow the instructions to install the migration tool provided by Salesforce. Migration Tool vs Eclipse

Many developers are using Eclipse today to deploy their Salesforce code. Though Eclipse is fairly simple, it’s extremely slow and painful. Salesforce developers can look to the Ant migration tool to speed up deployments where possible.

Limitations of the Migration Tool

The migration tool is not perfect though and it has some limitations. Because it relies on the Salesforce metadata API, the tool is not able to deploy all metadata types. Some types that are not supported by the API and there are other types which 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 migration tool can also be dangerous if it’s not included with source control. When doing deployments via the command line tool, it can be easy to clobber the code of your coworkers, leaving you in a situation where you overwrite Salesforce code made by your colleagues.

As a command-line utility, the migration tool can be intimidating to some members of the team. If you’re not comfortable using the command line you may not like using the Ant tool. Furthermore, many admins and other Salesforce stakeholders will not be able to deploy using the migration tool.

Finally, the Salesforce migration tool requires significant maintenance and setup. As we’ve talked to more Salesforce developers, we’ve learned just how painful can costly it can be to setup and maintain Ant scripts. You need to write scripts and handle edge cases and errors. You need to configure Jenkins or Bamboo or another build system. To maintain a good deployment process with the Ant migration tool requires at least one full time employee and maybe more depending on the size of your team and Salesforce implementation.

Continuous Integration for Salesforce with Blue Canvas

Blue Canvas is designed to do a lot of the work that the migration tool does, but in a much simpler and more cost effective way.

First, Blue Canvas makes deployments based on Git. This means that your source control and CI system are intimately connected. This means there is no danger of having one developer or admin overwrite the work of another. Blue Canvas can also do differential deploys which are faster than typical Ant deployments because they only involve the files and lines of code that have changed. Blue Canvas is also designed to take the changes coming from Salesforce DX and make them simple and accessible to you with no changes to your workflow.

Most importantly, there are no maintenance or setup headaches with Blue Canvas. You can set up CI and source control in a matter of four clicks and 1 minute. No one needs to make major adjustments to their daily workflow and yet you get the benefit of continuous integration.

More like this