Quick Guide to Salesforce Inspector & SOQL

I for one could not survive a day using Salesforce without Salesforce Inspector and the Data Export feature. Today is the day that I show you how to also use these tools in a short amount of time too. 

If you’ve never used Salesforce Inspector before and have only just installed it. You will see a light arrow on the side of your screen whilst you’re in your Salesforce Org. Before you do anything navigate to a record or object.

Example below shows an Account record, and what happens if you click that arrow on the side of the page. 

Many of you will be familiar with Salesforce Inspector and only use the “Show All Data” tool to be able to see all the data stored on a record including those not displayed on the Page Layout as well as the Field API Names and Data Types and many more columns.

Below is an example of this “Show All Data” feature and highlighted is a text box where you can search for all things related to your record.

Salesforce Inspector – Data Export – SQL Meets Salesforce (SOQL) 

This quick guide is not designed to teach you the concept of SQL (Structured Query Language) but designed to give you the tools to make queries on objects that will bring you a lot of information quickly that you can use quickly and easily. 

To the right, you can see the Salesforce Inspector window, and if you select the “Data Export” button this will move you to the screenshot below. 

Now what if I told you that with a super simple SOQL query you could find a vast amount of information within your org without leaving this screen. 

A query is made up of many keywords, but in this tutorial, I’m going to let you know about 4 of them. For further reading material please refer to this guide:
Salesforce SOQL

Here is an example of a SOQL Statement: 

SELECT ID, Name, AccountNumber, BillingStreet, BillingCity, BillingCountry, Type

FROM Account

WHERE BillingCountry IN (‘USA’,’US’)


I have highlighted the keywords that SOQL uses to make a query and here is the definition to help you make your own queries in the future. 

FROM: Why did I start with FROM when clearly SELECT is first? I do not say this lightly, this is the most important part of the query because it states what object you wish to query and allows you “access” to all the fields within that object. Below I have started a query.

SELECT: This is the information you wish to return, maybe it’s the name of the Account and its address. All you need to know, and use is the “Field API Names” (Not “Field Labels”).  To make life even easier if you construct a query in this form: 

WHERE: This is keyword means FILTER. In the query above, I used “BillingCountry IN (‘US’, ‘USA’)”, this means return All Accounts that have a Billing Country = US AND Billing Country = USA. The IN operator allows you to list strings that your field could equal. Very helpful for choosing particular picklist values, only downside to this is if you make a typo, you will not return accurate results. 

You can use other operators such as: > (Greater Than), < (Less Than), >= (Greater Than or Equal to),<= (Less Than or Equal To), these are very helpful when looking at currency fields or numeric fields. 

Top Tip: If you want to use the WHERE clause on numeric fields, please check the field is actually: numeric, integer or currency. There are times where admins populate fields with numbers, but they are text field.

ORDER BY: This keyword is as it sounds, it allows you to order your data as you wish. It magically requires no data type information to use, so you can order by: Dates, Numbers and Letters. You also are not limited to ordering by one field, the order in which you write the field names will be the order that the SOQL statement will order your data. 

It’s important to note that you do not require the WHERE or ORDER BY in every query, but they are useful keywords to note, and they are not the only ones. 

Here is the result of the original query: 

As you can see it’s a nicely laid out table that can be copied into: Excel, CSV, and JSON if you wish. 

I could go on, but I feel I’ve thrown enough information at you for now. Although before I finish, it is worth noting that within your SELECT statement you can add functions that allow you to aggregate your date, I will save the majority of this topic for another time, but one very useful function is called COUNT and below I will screenshot how it works. 

As you can see just by using COUNT I can return the number of results rather than any data at all, which can be very useful, and if I had removed the WHERE clause I could have returned a count for all the Accounts within my Org, and this would be true for any object I use in the WHERE clause, be it Standard or Custom. 

There you have it, a run through of using Salesforce Inspector and SOQL. I really hope this helps get people started querying there Orgs, and I hope to do an additional couple of top tips to add to this one. 

Thanks for reading,

Steve Bennett

The Tether Team

#salesforce #salesforcecrm #tethertips #tether #org #soql #guide #walkthrough

Share the Post: