Copying data is a very powerful tool.We all have done that in our High schools, copying assignments.It also plays a significant role in the Professional world.Lets 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 sandbox,
2.) sandbox to Production,
3.) Developer Org to Developer Org.
For first two scenarios, creating Change sets is easy, you can also use ANT Migration..But for 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@example.com
sf.password = passwordSecurityToken
ORGANIZATION 2 :
sf1.username = firstname.lastname@example.org
sf1.password = passwordCN82A1pWsJigrSSTFDXXXXXX
# Open Terminal & type command – cd/home/manpreet/Desktop/salesforce_ant_40.0/sample
You sample folder somewhat looks like :
# 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.
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.
**** 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 an Custom Object but you have not yet deployed that Custom Object then 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