3

I wasn't clear - I am writing a lot of code on my sandbox, and I use the Developer Console for that.

I want to export all the classes and Triggers I write, for backup. Using Meta API - I am not looking to export a single document/file.

[WAS:I want to keep a backup of my entire APEX codes (classeses, triggers, etc) Is it possible? and if so, how?}

2
  • Don't you consider this a very broad question with multiple possible solutions, being very subjective in nature. ? Have you tried using the metadata API or reading it's documentation ? Tooling API should cover the same possibilities if your needs are restricted to apex. How about visualforce or configuration based business logic ? How do you want to manage (or restore) backups ? Apr 10, 2014 at 8:20
  • 2
    What I was trying to say above is, that this isn't twitter, you can add details and context to a question. The quality of a question, and answers greatly improves if you display you have done some research of your own, and have a specific issue that can be answered. Apr 10, 2014 at 9:08

1 Answer 1

19

You can use the Meta-data API for these purposes. We do so at work quite often.

There are two channels we adopt, basically both the same, but using different IDEs (Force.com IDE and SublimeText/MavensMate). Here I will explain how to do this using the Force.com IDE (available from the Eclipse foundation, instructions here) and install it on your machine, you can then create a new "project" in it, which will suck-down all your files (Apex) and any selected Meta-data.

To create a new project in the IDE, you will need your username and password, and security token (available from "My settings" in the interface) and then fill in the "New Force.com Project" form.

new project

Once you have connected to the project, you can add/remove meta data components (including Apex Classes and Apex Triggers) and click "ok". This process can take quite a while, but it will pull all your classes and data down to the local machine.

metadata

You will see them all listed in the file navigator on the left.

enter image description here

You can find the exact location of the files by right clicking on the project name on the left and selecting "Properties" and then "Resource" - this will lead you through to the location of the folder on your PC and you can Zip/Copy save them away.

There are also a number of version control plugins for the Force.com IDE such as SVN and CVS which will allow you to archive and manage your data and classes as well.

3
  • 1
    please don't forget @Saariko if an answer helps/solves your question to vote/accept it so the community knows this is the case :) Apr 10, 2014 at 13:44
  • Thanks @simon-lawrence. I could download a backup using your answer.
    – MnZ
    Jul 29, 2016 at 10:01
  • I think Force.com is already deprecated. So this way cannot be done anymore. New solution should be to use VSCode
    – compski
    May 26 at 9:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .