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.
Attribution to: Peter Knolle
Possible Suggestion/Solution #1
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.
Anup
Attribution to: Anup
Possible Suggestion/Solution #2
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 :)
Attribution to: Sathya
Possible Suggestion/Solution #3
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.
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.
Attribution to: Daniel Ballinger
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/707