ABSYZ ABSYZ

  • Home

    Home

  • About us

    Who We Are

  • Our Expertise

    What we Do

  • Our Approach

    How We Do It

  • Products

    What We Made

  • Industries

    Who We Do It For

  • Clients

    Whom We Did It For.

  • Article & Blogs

    What Experts Think

  • Careers

    Join The Team

  • Get In Touch

    Let’s Get Started

ABSYZ

Automate metadata backup of your Salesforce org with the help of ANT and GIT

Home / Article & Blogs / Salesforce / Automate metadata backup of your Salesforce org with the help of ANT and GIT

Automate metadata backup of your Salesforce org with the help of ANT and GIT

By Team ABSYZ inSalesforce, Uncategorized

When working with a team on a Project , the situation often arises that more than one person end up working on the same class and overwrites each other code. This could turn into a nightmare if you  don’t have a backup of the org to refer to and merge the changes.

We faced the same situation in one of the project I was working on , and I took it upon myself to find a better way to take metadata backup rather than manually taking it in eclipse or any other IDE.While looking for a way for this I stumbled across an excellent post by Douglas C. Ayers Blog Post. This blog post is an extension of the same.

Pre-requisite:

Java version 1.6 or higher

Part 1:- Setting up ANT

1) Download the latest version of ANT from Apache ANT project  and extract it in a folder of your choice. This will be your ANT_HOME environment variable.
How to set up an environment variable

Apache ANT
1

ANT_HOME

2

2) Login to your Salesforce org and go to the following address.
Salesforce migration tool to download Salesforce Migration Tool and extract it in a folder.
You will find a Salesforce.jar file in the extracted file. Copy it and paste it in the ‘lib’ folder of Ant home directory.

3) Set up an Environmental Variable for bin folder of your Ant directory , call it Path.

4.PNG

4) Check whether ANT is installed properly:
Open your command prompt and type ant –version to check the version of the ANT installed in your machine

CMD

 

5) Define Project Properties:
For this ANT uses 3 files ( build.properties, build.xml & package.xml) all 3 could be found in the sample folder of the folder extracted in step 2. Copy all three files in a separate folder in which you intend to take your code backup.  Make appropriate changes in these files e.g : Your salesforce login and password, what components you want to extract etc.

Part 2:  Create a project and Push to Git

 

1) Retrieve your metadata mentioned in package.xml by going to the folder in which you saved these files in command prompt and type the below command

ANT retrieveCode

2) The previous step will fetch the metadata from your Salesforce org to your local machine. Now you need to create a Git repository in which you have to push and commit this project. Refer the guide in the below link to check details on how to do it.

https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/

 

Part 3: Schedule your metadata retrieval.

1) You can write a shell script which will run on system startup to retrieve your code from salesforce org and pushing it to your Github repository.

2) Your shell script would look something like this :

[code language=”java”]

@echo OFF
cd C:/
git add .
git commit -am “Daily Sandbox backup”
git push -v -u
echo Git operation Done
cd ..
ant retrieveCode

[/code]
Add the above file as .cmd

3) Go to your “Run” Dialog box by pressing windows and R keys together and type shell:startup.
A folder will open , In this folder paste your script file.

 

Now, whenever your system boots ANT will retrieve your metadata and then you will push it to your repository.

ANTAutomateBackupGitHubMetaData
91
Like this post
117 Posts
Team ABSYZ

Search Posts

Archives

Categories

Recent posts

10 Amazing Benefits of Salesforce Marketing Cloud

10 Amazing Benefits of Salesforce Marketing Cloud

How to Set SMART Goals for Employee Performance?

How to Set SMART Goals for Employee Performance?

Difference Between ERP and CRM? What Is Their Importance?

Difference Between ERP and CRM? What Is Their Importance?

What You Need To Know About India Salesforce Days 2022 – Platform Accredited Professional

What You Need To Know About India Salesforce Days 2022 – Platform Accredited Professional

<strong>Top digital transformation challenges affecting the businesses in 2022</strong>

Top digital transformation challenges affecting the businesses in 2022

  • Previous PostWorkAround for PDF Rendering in SF1
  • Next PostCreate Lightning Charts With Chart.Js

Related Posts

What You Need To Know About India Salesforce Days 2022 – Platform Accredited Professional
Salesforce

What You Need To Know About India Salesforce Days 2022 – Platform Accredited Professional

What Is Salesforce Commerce Cloud?
Commerce Cloud Salesforce

What Is Salesforce Commerce Cloud?

Why Do We Use Lightning in Salesforce?
Lightning Salesforce

Why Do We Use Lightning in Salesforce?

<strong>Salesforce announces NFT Cloud pilot with far-reaching impact</strong>
Salesforce

Salesforce announces NFT Cloud pilot with far-reaching impact

Leave a Reply (Cancel reply)

Your email address will not be published. Required fields are marked *

*
*

ABSYZ Logo
  • About us
  • Article & Blogs
  • Careers
  • Get In Touch
  • Our Expertise
  • Our Approach
  • Products
  • Industries
  • Clients
  • White Papers

ABSYZ Software Consulting Pvt. Ltd.
USA: 49197 Wixom Tech Dr, Wixom, MI 48393, USA
M: +1.415.364.8055

HYD – India: 6th Floor, SS Techpark, PSR Prime, DLF Cyber City, Gachibowli, Hyderabad, Telangana – 500032
M: +91 79979 66174

2nd Floor, 91Springboard, Padmavathi Complex, 80 Feet Rd, Koramangala, 8th Block, Bengaluru, Karnataka-560095.
+91 8886332345

Copyright ©2020 Absyz Inc. All Rights Reserved.

youngsoft
Copy
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “ACCEPT ALL”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent. Privacy Policy
Cookie SettingsREJECT ALLACCEPT ALL
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled

Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.

CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.

Functional

Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.

Performance

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

Analytics

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.

Advertisement

Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.

Others

Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.

SAVE & ACCEPT