Developer Console Basics (2024)

What Is a SOQL Query?

SOQL stands for Salesforce Object Query Language. You can use SOQL to read information stored in your org’s database. SOQL is syntactically similar to SQL (Structured Query Language).

You can write and execute a SOQL query in Apex code or in the Developer Console’s Query Editor.

Execute a SOQL Query

Before we start writing and executing queries, you need some data in your Salesforce org that we can search for. Let’s add the contact details of three Control Engineers sent by Mission Control to guide your spaceship away from asteroid 2014 QO441.

  1. Select Debug | Open Execute Anonymous Window.
  2. Copy the following code, paste it, and execute it. This code adds the contact details of three Control Engineers to the Contact object in your database.
    // Add first contact and related detailsContact contact1 = new Contact( Firstname='Quentin', Lastname='Foam', Phone='(415)555-1212', Department= 'Specialty Crisis Management', Title='Control Engineer - Specialty - Solar Arrays', Email='qfoam@trailhead.com');insert contact1;// Add second contact and related detailsContact contact2 = new Contact( Firstname='Vega', Lastname='North', Phone='(416)556-1312', Department= 'Specialty Crisis Management', Title='Control Engineer - Specialty - Propulsion', Email='vnorth@trailhead.com');insert contact2;// Add third contact and related detailsContact contact3 = new Contact( Firstname='Palma', Lastname='Sunrise', Phone='(554)623-1212', Department= 'Specialty Crisis Management', Title='Control Engineer - Specialty - Radiators', Email='psunrise@trailhead.com');insert contact3;
    Now we can use the Query Editor to write and execute a SOQL query to find these Control Engineers. SOQL queries search for data in specific objects. You can add an optional condition in the WHERE clause to narrow down your search.
  3. Enter the following query in the Query Editor tab.
    SELECT Name, Phone, Email, Title FROM Contact WHERE (Department = 'Specialty Crisis Management')
  4. Click Execute.

The results display the details of the contacts who work in the Specialty Crisis Management department.

Developer Console Basics (1)

You can use another SOQL query to find contacts in other departments, or to see whether anyone else has created records for more Control Engineers. To rerun a query, click Refresh Grid in the Query Results panel.

A SOQL query that you execute using Apex code is called an inline SOQL query. Let’s see how you can use the Developer Console to search for contacts working in the Specialty Crisis Management department using an inline SOQL query.

This time, let’s also try ordering the results alphabetically by name.

  1. Select Debug | Open Execute Anonymous Window.
  2. Enter the following code.
    Contact[] theseContacts = [SELECT Name, Phone, Email, Description FROM Contact WHERE (Department='Specialty Crisis Management') ORDER BY Name];// Log a count of how many contacts were foundSystem.debug(theseContacts.size() + ' contact(s) returned.');// Log all values in the array of contactsSystem.debug(theseContacts);
  3. After the code has executed, open the log.
  4. To view only the USER_DEBUG messages, select Debug Only. The results show the number of accounts returned and the contact details in alphabetical order.

To delve deeper into SOQL queries, check out the Apex Basics & Database module.

Developer Console Basics (2024)

FAQs

What does developer console do? ›

The Developer Console is an integrated development environment with a collection of tools you can use to create, debug, and test applications in your Salesforce org. The Developer Console can help with many of your development tasks.

How do I navigate to developer console? ›

To open the developer console in Google Chrome, open the Chrome Menu in the upper-right-hand corner of the browser window and select More Tools > Developer Tools. You can also use Option + ⌘ + J (on macOS), or Shift + CTRL + J (on Windows/Linux).

How do I run developer console? ›

Step 1: To open the console in Chrome, use this keyboard shortcut: "Cmd + Option + J" (on a Mac) or "Ctrl +Shift +J" (on Windows). As an alternative, you can right-click on the webpage and click "Inspect" to open the developer console.

How do I arrange code in developer console? ›

Use the Source Code Editor: Open a working set of code files and switch between them with a single click. Format Your Code Files: You can use the Prettier code formatter to format your Aura components in Developer Console. To prettify the code in an open file, select Edit | Fix Code Formatting. Or, press Ctrl+Alt+F.

How do I use developer tools console? ›

The simplest is to just right-click somewhere on the page and then select “Inspect Element” in the context menu that appears. You can also launch the developer console using a keyboard shortcut. The shortcut for most browsers on Mac is Command + Option + I, for Windows you can use Ctrl + Shift + I.

What is the purpose of developer console in Android? ›

The Google Play Developer Console is your home for publishing operations and tools. Upload apps, build your product pages, configure prices and distribution, and publish. You can manage all phases of publishing on Google Play through the Developer Console, from any web browser.

What is the developer console feature? ›

The developer console provides: The Build section contains customization features and lets you add the custom components and functionality for your toppings. The Integrate section allows you to add developers to the console. The Utilities section allows you to create connections with third-party apps.

What is a capability of the developer console? ›

Real-Time, Quick Debugging with Debug Logs. One of the powerful features of the Developer Console is the debugging capabilities. Debugging is the action of finding issues in the system.

How do I extract data from developer console? ›

Here is a simple way:
  1. Run your query in query builder.
  2. Hit F-12 and click on any row of the query builder's result.
  3. In developer console switch from tr to table.
  4. Copy table's html and paste into notepad.
  5. save notepad as html and open it in a browser.
  6. you can easily copy your desired rows or whole result set from here.
Aug 12, 2013

How do I test code in developer console? ›

Create a Test Run
  1. In the Developer Console, click Test | New Run.
  2. To limit how many tests can fail before your run stops, click Settings. ...
  3. To opt out of collecting code coverage information during test runs, click Settings and select Skip Code Coverage. ...
  4. Select a class in the Test Classes column.

What permission do I need to view developer console? ›

Required Editions and User Permissions
User Permissions Needed
To use the Developer Console:API Enabled AND View All Data
To view, retain, and delete debug logs:View All Data
To execute anonymous Apex:Author Apex
To use code search and run SOQL or SOSL on the query tab:API Enabled
3 more rows

How to write code in console? ›

Try a command: Once the console is open, you can try running some JavaScript code by typing it directly into the console prompt and hitting enter. For example, you could type “console. log('Hello, world! ');” and press enter.

How do I set a checkpoint in developer console? ›

See Logs Tab.
  1. Open the Apex class or trigger in the Source Code Editor.
  2. Click in the margin to the left of the line number where you want to set the checkpoint. ...
  3. Execute the code with the Developer Console open.
  4. View your checkpoints and results on the Checkpoints tab.

How do I run console VS Code? ›

Select Run > Step Into or press F11 . Visual Studio Code runs the Console.

What is console programming used for? ›

A console application or command-line program is a computer program (applications or utilities) designed to be used via a text-only user interface, such as a text terminal, the command-line interface of some operating systems (Unix, DOS, etc.) or the text-based interface included with most graphical user interface (GUI ...

What is the point of developer kits on consoles? ›

Game development kits (GDK) are specialized hardware and software used to create commercial video games for game consoles.

What is the purpose of the developer console in Roblox? ›

The Developer Console is a tool for debugging your experience when testing in Studio or running it in production. It shows log messages and errors similar to the Output window and detailed information on Memory, Network, and more.

Top Articles
Latest Posts
Article information

Author: Neely Ledner

Last Updated:

Views: 6337

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Neely Ledner

Birthday: 1998-06-09

Address: 443 Barrows Terrace, New Jodyberg, CO 57462-5329

Phone: +2433516856029

Job: Central Legal Facilitator

Hobby: Backpacking, Jogging, Magic, Driving, Macrame, Embroidery, Foraging

Introduction: My name is Neely Ledner, I am a bright, determined, beautiful, adventurous, adventurous, spotless, calm person who loves writing and wants to share my knowledge and understanding with you.