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?}

  • 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 ? – Samuel De Rycke Apr 10 '14 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. – Samuel De Rycke Apr 10 '14 at 9:08
18

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.

  • 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 :) – Simon Lawrence Apr 10 '14 at 13:44
  • Thanks @simon-lawrence. I could download a backup using your answer. – MnZ Jul 29 '16 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.