Salesforce Ant Migration in Ubuntu

Salesforce Ant Migration Ubuntu

Copying data is a very powerful tool. We all have done that in our High schools, copying assignments.emoji1

It also plays a significant role in the Professional world. Let's discuss a use-case. If we want to copy Data(like Apex Classes, custom Fields, Triggers, Reports, etc.) from one salesforce Org to another, what efforts does it take?

There are three scenarios for it.

Copying data from -

1) Sandbox to the Sandbox,

2) Sandbox to Production,

3) Developer Org to Developer Org.

Salesforce Data Migration

For the first two scenarios, creating Change sets is easy, you can also use ANT Migration. But for the third scenario, we will have to use ANT Migration.

# For that first you need to download this from Google Drive - https://drive.google.com/drive/folders/1h0Sim-jk1xdoyCZm6ZfEmKqdgLyEpYEr?usp=sharing package and place it anywhere as per your convenience. In my case, I have placed it on Desktop.

-----------------------------------

# Now go to - salesforce_ant_40.0/sample/build.properties Folder using point and Click(not by Terminal) and open build.properties file. Now Specify the login credentials for the desired Salesforce organization.

ORGANIZATION 1 :

sf.username = [email protected]
sf.password = passwordSecurityToken

ORGANIZATION 2 :

sf1.username = [email protected]
sf1.password = passwordCN82A1pWsJigrSSTFDXXXXXX

-----------------------------------

# Open Terminal & type command - cd/home/manpreet/Desktop/salesforce_ant_40.0/sample

Apache ANT Migration

You sample folder somewhat looks like :

Sample Folders For Data Migration

-----------------------------------

# Next Command - ant retrieveUnpackaged

where retrieveUnpackaged is the folder name where Data is ant retrieved. With this, a new folder with the name retrieveUnpackaged will be created in your sample folder.

UnPackaging Data in Salesforce Migration

Hence your ORGANIZATION 1 Data is retrieved.

-----------------------------------

# Next Step is Deploying this to ORGANIZATION 2, for that type command - ant deployUnpackaged. Your Data will be deployed.

Apache ANT Migration

 

Migration in SalesforceIn short, these 3 commands -

-----------------------------------

#1. cd/home/manpreet/Desktop/salesforce_ant_40.0/sample

#2. ant retrieveUnpackaged

#3. ant deployUnpackaged

-----------------------------------

**** Note: Your Data will be deployed if nothing is missing in your package.xml file. Else errors will be thrown if some dependencies are missing. Like if you are trying to deploy Custom fields of a Custom Object but you have not yet deployed that Custom Object then an error will be thrown as dependency is missing. Add that Custom Object first in your package.xml file.

"Without data, you are just another person with an opinion." – W. Edwards Deming

Popular Salesforce Blogs