3

I have worked as SF dev for many years and I have asked this question to many more experienced than me without a conclusive answer.

How does Developer console (DC) save it's state (including Anonymous Editor (AE))?

For example, say I open 2 Apex classes, write a query in the query editor (QE), and type some stuff in AE. As long as my session is active everything maintains state - those 2 files stay open, my code in AE persists, and my query in QE stays.

I close everything down - come back another day and all of it is gone.

BUT, another time I do the same thing and when I come back DC has maintained state from days ago.

so what is the 'algorithm' here? it just seems really inconsistent .. but I am sure there is some pattern that I am missing

2
  • From what I experienced, it seems to be storing it in SFDC on per User basis. Do you share creds with someone else?
    – ytiq
    May 8 '21 at 9:21
  • yes we use the partner hub. but even when I have my own account (and even my own SB - so nobody else logs in) it has done its own thing
    – MarcLee
    May 9 '21 at 10:54
4

Salesforce uses two database tables, the IDEWorkspace (e.g. Id=1de000000012345) and IDEPerspective (e.g. Id=1dg000000012345) objects to keep track of your Developer Console state. It's supposed to save periodically/automatically. These settings are per-user, so if you're sharing your login with another developer, they could be overwriting your settings. Also, having more than one copy of Developer Console logged in at once tends to cause problems.

When everything works well, it remembers the files you have open, including any edits, recently used queries, the recent Execute Anonymous script, etc. I haven't found any pattern to this, aside from using multiple windows (e.g. actual multiple copies of DC open in multiple tabs), a spotty Internet connection, or a "bad workspace," and these days, I prefer to simply use VS Code and SFDX for any serious development, so it's less relevant, as VS Code always remembers your open files and workspace configuration by default.

If you're having troubles with your state saving/loading, you can try deleting your workspace, as outlined in 000332898.

Developer Console menu may become non-functional sometimes, because of the workspace being in bad state. To restore the functionality, follow the following steps.

Fix 1:

  1. Login and open Developer Console by Chrome

  2. Open Developer tools and select Network

  3. Reload on Developer Console

Fix 2:

  1. Login to Workbench and go to REST Explorer

  2. Use the following query in Workbench to get the IDEWorkspace

/services/data/v31.0/tooling/query/?q=SELECT id, name from IDEWorkspace

ID of IDEWorkspace is "1dexxxxxxxxxxxxxx".

  1. Do GET operation for the found id with following query "/services/data/v29.0/tooling/sobjects/IDEWorkspace/1de1a0000014sEWAAY"

  2. You will see the content of IDEWorkspace

  3. Do DELETE operation on found record.

  4. Re-open Developer Console.

  5. Developer Console will work fine. As we created a new workspace and the old workspace has been deleted.And the slowness will also be removed.

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.