An Introduction to Salesforce Migration Tool (ANT) for Admins

Share this article...


One of the things I really like about Salesforce is that there is always something new to learn. This week, I needed to use a new tool called the Force Migration Tool (also known as ANT) for the first time. Even though the tool itself is not new, I was really impressed by it. In this blog post,  I will try to explain what ANT is, why you need to know about it and how to get your hands on it. 

What is ANT?

ANT is a tool to help you move Metadata (information such as Objects/Reports/Apex Classes/Visualforce Pages) between different Salesforce environments. Once configured, ANT allows you to easily move configuration from one Salesforce environment to another with a series of simple text commands that you enter into a Terminal window on your computer.

ANT commands are run in a terminal window on your computer
ANT commands are run in a terminal window on your computer

Why do you need to know about ANT?

1. You need a flexible way to deploy changes to multiple Salesforce environments at any one time (more on that below).

2.You want to start creating Salesforce configuration on your local computer using a text editor such as Sublime Text. If you are already using Eclipse this post talks about the difference between ANT, Maven, and Eclipse.

3. You are working with a team who are already using ANT.

Keeping it all in Sync

Let’s start with the biggest advantage that ANT offers.

Imagine that you have 2 different members of your team building some ‘cool new stuff’ in their respective development environments. At some point, both of these developers will need to put this new functionality into your testing and live environments.

If each developer worked independently, you may not know whether their work will be compatible with the other. ANT helps with this by giving you a powerful way to keep 2 (or more) Salesforce Orgs synchronised throughout your development process.

Regularly comparing and synchronizing your new development work helps to ensure that any incompatibilities are found much earlier on in your process. This technique is known as ‘Continuous Integration’.

Screen Shot 2016-07-03 at 14.15.02
Ant provides a powerful way to keep 1 or more Salesforce environments synchronised

What about Change sets?

Salesforce gives you a declarative tool to move configuration from a Salesforce Sandbox (test) environment through to another Sandbox or your Production environment.

The change set tool is very straightforward, however, items need to be added one by one, it is easy to miss components, and change sets can only be sent between orgs that are affiliated with your production org. For example, you can only deploy a change set from a production org and its sandbox, or two sandboxes created from the same org can send or receive change sets.

ANT can deploy configuration from one Salesforce environment to a completely unrelated second environment.

Official Documentation

Trailhead Module

What about a Package?

A Salesforce developer can also package up changes to an unmanaged package. This would allow you to take some code from Salesforce Environment 1 and deploy it to an unrelated Salesforce Environment 2.

However, packaging has limitations. You again need to manually create the package, adding in components one step at a time. You then need to upload the package to Salesforce. You then have to wait whilst that package synchronises across all of the Salesforce servers/nodes.

Finally, once it has done that you can install the package in your new environment, bringing across the new configuration.

Official Documentation

Trailhead Module

How do I get ANT?

If the flexibility of being able to move your Salesforce configuration between environments quickly and via a single command via your terminal has piqued your interest, have a go at setting up ANT and see if you can move a single item of your choice from environment A to environment B.

The tool is free to download and there is an excellent installation guide available here.

Good luck! Migration Guide

Using the Migration Tool

8 thoughts on “An Introduction to Salesforce Migration Tool (ANT) for Admins

  1. Why should Admins choose Ant? In what scenarios ANT should be used? Why cant we use Changesets or Eclipse? Just trying to understand the advantage of using ANT over Changesets or Eclipse?

    1. I can tell you that we have used it many times when we want to delete APEX classes/triggers at the same time.

      In addition, when you have hundreds of components to deliver, it’s actually easier to generate the schema using any number of tools and then using a formula in Excel, to generate the nodes and copy/paste into your file.

      Not my deployment tool of choice, but definitely belongs in the toolbelt.

  2. Nice piece Iain, thanks for sharing. You mentioned use of unmanaged packages. I like to use them with ANT to move metadata between orgs. It’s easy for the various package.xml and destructivechanges.xml files to get out of sync. If I ever need to revert an org back to initial conditions I can retrieve and undeploy using the package name as follows:

  3. Hmm it appears like your blog ate my first comment (it was super long) so I guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog.
    I as well am an aspiring blog blogger but I’m still new to everything.
    Do you have any recommendations for inexperienced blog
    writers? I’d certainly appreciate it.

  4. Before came to this post I was familiar with the “Over the Edge” salesforce migration tool but not with the ANT. Thank you for the brief explanation. I would appreciate if you write a new post about ANT’s benefits. Either way keep posting on other topics.

Add Comment