
Salesforce Apex Environment

Table of Contents
- Sandbox environment
- What is Developer Console?
- How to get started with Developer Console?
- Code execution steps
- Keyboard Shortcuts
- Developer console keeps showing loading, How to resolve?
- Unable to open developer console, how to resolve?
- Interesting Multiple Choice Questions
Salesforce Provides Sandbox and Developer Editions organization to develop Apex Code, you can use either of them for apex code development. A sandbox is a replica of the production environment in which you can build and test your code before deploying it to the production environment as it reduces the risk of getting errors in production.
Check out these top Salesforce interview questions and answers for extensive knowledge and informative details about Salesforce Admin, Developer, Integration, and LWC modules.
Sandbox Environment for Developing Apex code
It is a salesforce best practice to use the Sandbox environment for developing code and then deploy it to the Production environment. The operations you perform in your sandboxes are not reflected in your Salesforce production organization. Salesforce provides four types of sandboxes i.e,
- Developer Sandbox.
- Developer Pro Sandbox.
- Partial Data Sandbox.
- Full Sandbox.
Read more: Methods – Salesforce Apex
Sandboxes are available per salesforce edition type; it depends on what edition you have.
SANDBOX TYPE | PROFESSIONAL EDITION | ENTERPRISE EDITION | UNLIMITED EDITION | PERFORMANCE EDITION |
Developer Sandbox | 10 | 25 | 100 | 100 |
Developer Pro Sandbox | 5 | 5 | ||
Partial Copy Sandbox | Not Available | 1 | 1 | 1 |
Full Sandbox | Not Available | 1 | 1 |
Read more: What are Classes in Salesforce Apex?

Apex Code development tools: The following is a list of three tools that are available to develop apex code in all Salesforce editions.
- Force.com Developer Console
- Force.com IDE
- Code Editor in the Salesforce User Interface
Let’s take a look at working of the Force.com developer console
We are offering a real-time project based Salesforce course career building program for beginners!
What is Salesforce Force.com Developer Console? Explain
The Salesforce Developer Console is an integrated development environment (IDE) provided by Salesforce, offering a suite of tools and features that facilitate the development, debugging, and testing of Apex code, Visualforce pages, and Lightning components. It’s a web-based interface accessible directly from the Salesforce UI, providing a convenient and powerful platform for developers to write and manage their code. The Developer Console is particularly beneficial for its real-time debugging and performance data capabilities, allowing developers to execute and test code, view logs, and analyze resource usage and execution timelines.
Besides coding, the Developer Console provides valuable features for query optimization and data inspection. Developers can write and execute SOQL and SOSL queries directly within the console, inspecting the returned data or checking the efficiency of their queries. The console also offers advanced features like a detailed log inspector, a checkpoint feature for setting breakpoints and inspecting variable values in Apex code, and the ability to view the execution stack. These tools are essential for Salesforce developers aiming to build efficient, scalable, and bug-free applications on the Salesforce platform.
Read more: Loops in Salesforce Apex
How to get started with force.com Developer Console?
A Developer Console provides a set of tools you can use to develop, debug, and test applications within your Salesforce organization. It is an integrated development part of the salesforce organization.
Following are the steps to be followed to use the developer console:
Go to Setup and click on developer console from the drop-down in lightning framework, It will open it in a new window as shown in the below pics:


Here’s a list of operations you can perform using the developer console.
- Code writing and compilation of code: you can create an apex class, trigger, lightning component or visualforce page, etc using the source code editor and as soon as you save your code it will automatically be compiled on the force.com server.
- Debugging: Apex supports debugging. Using the Developer Console and the debug logs, you can debug Apex code and also you can set checkpoints to make debugging easier.
- Testing: You can build and execute test cases for a specific apex class and also inspect the code coverage.
- SOQL/SOSL queries: In the query editor tab you can perform both SOQL and SOSL queries.
- Color coding and autocomplete: In addition to auto-completion for class and method names, the editor uses a color scheme to make code elements easier to read.
Read more: Salesforce apex programming examples
Code execution steps in Developer Console:
Follow these steps to execute your code in the developer console.
Step 1: Open the Developer console from the setup.

Checkout: Data types in Salesforce Apex
Step 2: Click on Debug tab and select Open Execute Anonymous window or press CTRL+E directly to open the anonymous window

Step 3: A new window will appear in which you can write or paste the code and execute it as a whole or a highlighted piece of code and tick the checkbox open log as shown in the below image.

Checkout: DML statements in Salesforce
Step 4: After clicking Execute OR Execute Highlighted, debug log will open in which you can get all the details of success or failure of code.


Above steps should be followed to execute your code using force.com developer console.
Read more: Arrays in Salesforce Apex
Keyboard Shortcuts for a Salesforce Console in Salesforce Classic
- Ctrl + G / Cmd + G: Focus on primary tab search.
- Ctrl + Shift + T / Cmd + Shift + T: Open tabs menu.
- Ctrl + Shift + W / Cmd + Shift + W: Close current primary tab.
- Ctrl + Shift + [ / Cmd + Shift + [: Move to previous primary tab.
- Ctrl + Shift + ] / Cmd + Shift + ]: Move to next primary tab.
- Ctrl + Shift + L / Cmd + Shift + L: Open list of records for current tab.
- Ctrl + Up Arrow / Cmd + Up Arrow: Move up in a list.
- Ctrl + Down Arrow / Cmd + Down Arrow: Move down in a list.
- Ctrl + E / Cmd + E: Edit current record.
- Ctrl + S / Cmd + S: Save current record (in edit mode).
- Ctrl + Shift + X / Cmd + Shift + X: Close current subtab.
- Ctrl + Shift + U / Cmd + Shift + U: Open utilities pop-out.
- Ctrl + Shift + H / Cmd + Shift + H: Open history menu.
Collection is one of the important concept, checkout: Collections in Salesforce Apex
Developer console keeps showing “loading…” and crashes, how to resolve?
If you’re facing issues with the Salesforce Developer Console continuously loading or crashing, you can try a few straightforward solutions to resolve this problem. Start by clearing your browser’s cache and cookies, as accumulated data can sometimes lead to such issues. If that doesn’t work, try accessing the Developer Console in your browser’s incognito or private mode to bypass any cache or cookie problems.
Another step to consider is switching browsers. Compatibility issues are not uncommon, and using a different browser might instantly solve the problem. It’s also a good idea to check the Salesforce Trust website to see if there are any ongoing issues or maintenance activities that might be affecting Salesforce services.
Browser extensions can interfere with web applications, so consider disabling them to see if that resolves the issue. If the console is still not responding, try adjusting your browser’s script timeout settings, which can prevent the page from crashing due to long-running scripts.
Network connectivity can also be a culprit, so ensure that your connection is stable. If none of these steps work, check Salesforce’s known issues or reach out to their support team for assistance. As a temporary workaround, you might want to use alternative tools like Workbench or a third-party IDE for your immediate Salesforce development needs.
Read more: Strings in Salesforce Apex
Unable to open developer console, how to resolve?
- Clear Browser Cache and Cookies:Clear your browser’s cache and cookies to remove any stored data that might be causing issues.
- Use Incognito/Private Mode:Open your browser in incognito or private mode and try accessing the Developer Console. This mode bypasses cached data and cookies.
- Switch Browsers:Try using a different browser to see if the issue is browser-specific.
- Check Salesforce Trust Site:Visit the Salesforce Trust site (trust.salesforce.com) to check if there are any service disruptions or maintenance activities.
- Disable Browser Extensions:Temporarily disable any browser extensions, as some can interfere with the functionality of web applications.
- Check Network Connectivity:Ensure your internet connection is stable. Sometimes, poor connectivity can cause loading issues.
- Consult Salesforce Known Issues:Look for your issue on Salesforce’s known issues page or forums. Others might have experienced the same problem and found a solution.
Read more: Database methods – Salesforce Apex
Top 5 Multiple Choice questions on Salesforce Developer Console for beginners
- What is the primary purpose of the Salesforce Developer Console?
- A) To manage user profiles and permissions
- B) To develop and debug Apex code, Visualforce pages, and Lightning components
- C) To track sales and customer interactions
- D) To customize the Salesforce UI
- Which feature in the Developer Console allows you to execute anonymous Apex code?
- A) Query Editor
- B) Test Execution
- C) Apex Profiler
- D) Execute Anonymous Window
- Which of the following can you use to view the debug logs in the Developer Console?
- A) Log Inspector
- B) SOQL Query Editor
- C) Apex Test Execution
- D) Schema Builder
- What can you use the Query Editor in the Developer Console for?
- A) Creating and editing Visualforce pages
- B) Writing and executing SOQL and SOSL queries
- C) Monitoring and optimizing the performance of Apex code
- D) Managing and deploying Lightning components
- In the Developer Console, what is the purpose of the Test Execution feature?
- A) To deploy Apex code to production
- B) To execute and monitor the performance of SOQL queries
- C) To run Apex tests and view code coverage results
- D) To track changes made to the Salesforce schema
Checkout: SOSL Query in Salesforce Apex
Answers:
- Answer: B) To develop and debug Apex code, Visualforce pages, and Lightning components
- Answer: D) Execute Anonymous Window
- Answer: A) Log Inspector
- Answer: B) Writing and executing SOQL and SOSL queries
- Answer: C) To run Apex tests and view code coverage results
Before reading this tutorial, you can read Salesforce Apex Overview as first tutorial. You can read the Salesforce Apex Examples.