I use the Force.com IDE and sometimes execute anonymous blocks of code through the Execute Anonymous view. I have used other tools like SQL Developer from Oracle and they keep a persistent history of executed queries.

I know that the result of the execution contains the debug log and that I can set up a debug log for a particular user, but I'm looking for something a bit different.

Is there some place that a history of anonymous block executions is persisted, preferably available in the IDE or possibly in Salesforce itself? I'm not really interested in the result, but just the block that was executed.

I'm hoping for something in the IDE that would allow me to call up previously executed blocks, but I'd be willing to use other tools such as the Developer Console or third party tools.

3 Answers 3


Currently, there is no way of retrieving historical anonymous code block executions. If you close the IDE, then you lose what you have in the anonymous block, but if you are working with the Developer Console in the browser, and log out of your current session, you still have the last executed code when you log back in.



Under the third party tools category of answers, I've added basic support for a history of anonymous apex executions to the FuseIT SFDC Explorer.

Recent anonymous Apex in the FuseIT SFDC Explorer

Using the recent button up in the top left will bring up a list of successfully executed anonymous apex blocks. Clicking on one will restore the content so it can be executed again or edited as required.


I just tried something interesting today.. I had to do a lot of data deletions.. So I used a notepad++ and framed different sets of queries and code and pasted it there in developer console anonymous block. I thought of saving the notepad++ but unfortunately it crashed. went to the developer console text box and did a ctrl+z and i was able to retrieve all previous executions that i did in that session... Not sure if this is the answer for your question.. But just in case if it helps you :)

  • I was hoping for something in the IDE (eclipse) which would allow me to pull up previously executed blocks, but I'm willing to look into the Developer Console again...when I first tried the Developer Console some months ago it was very buggy and lacked some of the IDE features (local history, warnings about overwriting changes on the server, etc.), but I've heard it's gotten better. Commented Aug 21, 2012 at 17:09
  • oh ok.. yeah definitely its better now and moreover in chrome its great.. in previous version of firefox it kept on hanging.. dev console has great features like breakpoints, checking heap size and all other stuff.. moreover the most important feature I like is checking debug logs quickly across sessions instead of going and adding a debug log entry and checking the same in the debug logs..
    – Sathya
    Commented Aug 21, 2012 at 20:37

You must log in to answer this question.

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