SOQL Explorer
SOQL Explorer is a powerful extension for running SOQL queries and editing Salesforce data directly from VS Code.
✨ Features
- 🔐 OAuth2 authentication (PKCE flow) with support for production, sandbox, and custom domains
- 🧠 Dynamic object and field suggestions while typing your query
- 🔎 Run SOQL queries in a dark-themed editor
- 📝 Interactive result table Inline edit of fields (text, picklist, lookup)
- 🔎 Field-level lookup support, with autocomplete and record ID input
- 📤 Update records directly in the table
- 🚽 Select and delete multiple records at once
- 🔁 Sort by column
- 📦 Support for large JSON fields and relational paths (
Loan__r.Account__r.Name
)
- 📚 Sidebar with object/field explorer and search
- ↻ History of executed queries with one-click restore
🆕 Recent Updates June 2025
Sticky Table Header
The table header (top bar) is now fixed during vertical scroll, making it easier to interpret large result sets.
Row Highlighting on Cell Focus
When a cell is focused (e.g., during editing or selection), the entire row is visually highlighted for better readability.
Resizable Table Columns
All columns in the results table can now be resized manually. Column widths persist across interactions to improve customization.
Improved Column Sizing for Picklists
Picklist fields and editable inputs now expand appropriately to accommodate content, resolving the issue where narrow column headers caused clipping.
Support for Aggregated Results (COUNT
, MAX
, etc.)
SOQL queries returning AggregateResult
are now fully supported in the main results table. Alias syntax (e.g., SELECT COUNT(Id) totalCount
) is correctly recognized, but not required.
Enhanced SELECT
Clause Parsing
The logic for extracting fields from the query has been improved to handle:
- functions with or without aliases (e.g.,
COUNT(Id)
or COUNT(Id) AS count
)
- multiple clauses (
ORDER BY
, LIMIT
, etc.)
Dynamic Field Mapping for Aggregate Output
Aggregate fields like expr0
, expr1
, or custom aliases are now dynamically detected and displayed in the table. Previously blank cells are now rendered properly.
Got it! Here's the English version you can drop into your README.md
under something like ## ✨ New Features
:
🎨 Improved Suggestion Styling
Autocomplete suggestions for objects, fields, and lookups now use a dark-themed background and lighter text for better readability in VSCode dark mode.
🛠️ Tooling API Support
Added a checkbox to execute queries via the Salesforce Tooling API instead of the standard data API. Useful for accessing metadata objects.
🗑️ Improved Bulk Deletion Handling
- Fixed a
414 URI Too Long
error when deleting too many records at once by implementing batch deletion (in groups of 200).
- Added a blocking overlay with a loading spinner while records are being deleted to clearly indicate background activity.
🔍 Nested (Subquery) Support
The query engine and results table now support nested SELECT
queries.
Each row with subquery data shows an inline 🔍 icon to expand a nested, scrollable table with related records.
Lookup fields (e.g. contact.firstname
, contact.account.name
) are correctly displayed.
🚀 Getting Started
1. Install Git and Node (if not already installed)
Make sure you have Git and Node.js installed on your machine.
🔐 Authentication Setup
This extension uses OAuth2 (PKCE) to connect to your Salesforce org securely. You have two options to configure authentication:
This extension no longer depends on native modules like keytar
.
All connection data is saved using VS Code's built-in Secret Storage API, which automatically encrypts credentials per OS using native keychains (e.g., Windows Credential Manager, macOS Keychain, or GNOME Keyring on Linux).
✅ Option 1: Use the built-in Connected App (Default)
No setup required. Just click "Login to Salesforce", and authorize the SOQL Explorer extension.
- The extension uses a pre-configured public Connected App.
- Works with any sandbox, developer, or production org.
- All credentials are stored securely using VS Code’s built-in Secret Storage API, with support for Windows, macOS and Linux — no native dependencies required.
🏢 Option 2: Use your own Connected App (Recommended for enterprise environments)
If your organization requires using a custom Connected App, follow these steps:
📖 Official Salesforce guide
- Go to Setup in your Salesforce org.
- Search for App Manager, then click New Connected App.
❗️ Don't see the "New Connected App" button?
This feature may not be enabled by default in your org.
Follow the steps from the Salesforce guide to enable it:
Enable the Connected App creation UI
From Setup, enter External Client Apps in the Quick Find box, and then select External Client App Settings.
Turn on Allow creation of connected apps.
To create a connected app, select New Connected App.
- Fill in the following:
- Connected App Name:
SOQL Explorer
- API Name:
SOQL_Explorer
- Contact Email:
your@email.com
Under API (Enable OAuth Settings):
- DO NOT enable:
Require Secret for Web Server Flow
Require Secret for Refresh Token Flow
- PKCE is supported automatically — no extra setting needed
Save and wait a few minutes for the app to be available.
Once created, go to Manage → Edit Policies and set:
- IP Relaxation →
Relax IP restrictions
(This is required to authorize from localhost.)
- Then return to the App Manager, click View on your app, and click Generate to get your Consumer Key and Consumer Secret.
Note:
The extension works out-of-the-box using a built-in public Connected App.
You only need to configure settings.json
if you want to use your own custom Connected App for enterprise control or custom domains.
Open the command palette (Cmd+Shift+P
/ Ctrl+Shift+P
) and select:
Preferences: Open Settings (JSON)
or Preferences: Open User Settings (JSON)
Then add the following settings:
{
"soqlExplorer.clientId": "YOUR_CONSUMER_KEY",
"soqlExplorer.clientSecret": "YOUR_CONSUMER_SECRET",
"soqlExplorer.loginUrl": "https://login.salesforce.com",
"soqlExplorer.redirectUri": "http://localhost:1717/oauth2/callback"
}
🔁 If you're logging into a sandbox, change "loginUrl"
to https://test.salesforce.com
.
✅ Example Settings for Production
{
"soqlExplorer.clientId": "3MVG9f4Sg6xGHZ...abcXYZ",
"soqlExplorer.clientSecret": "1A2345BC678...Z90",
"soqlExplorer.loginUrl": "https://login.salesforce.com",
"soqlExplorer.redirectUri": "http://localhost:1717/oauth2/callback"
}
🧪 Example Settings for Sandbox
{
"soqlExplorer.clientId": "3MVG9f4Sg6xGHZ...abcXYZ",
"soqlExplorer.clientSecret": "1A2345BC678...Z90",
"soqlExplorer.loginUrl": "https://test.salesforce.com",
"soqlExplorer.redirectUri": "http://localhost:1717/oauth2/callback"
}
🧭 Opening the Explorer
To launch the interface, open the command palette and run:
SOQL Explorer: Open
This opens the main WebView panel with the query editor, object sidebar, and result table.
🔁 Switching Org or Logging into a New One
Each time you click "Login to Salesforce", you'll be prompted to:
- Use a saved connection, or
- Log in to a new org (production, sandbox, or custom domain)
After login, the UI resets:
- Query input is cleared
- Result table is cleared
- Sidebar reloads all objects and fields
- The field counter (
x / y objects loaded
) is restarted
- Toasts confirm login completion
All login sessions are securely saved via keytar.
🗑️ Deleting a Saved Connection
To remove a saved org connection, run the following command from the command palette:
SOQL Explorer: Delete Saved Connection
You’ll be asked to select the connection by name. This is helpful to clean up stale orgs or tokens.
🧠 How It Works (Advanced)
After login, all queryable sObjects are loaded and shown in the sidebar
Each object can be expanded to view fields (fetched in throttled batches of 15)
The sidebar is fully searchable (objects + fields)
Clicking a field adds it to the current query
Inline editing is supported for:
- Text fields (editable via contenteditable)
- Picklists (dropdown)
- Lookups (dynamic search by
Name
)
Lookup fields support ID input or remote search after 3+ characters
Query history is accessible via a popup, storing your last 20 queries (with date and object)
Sorting, filtering, multi-select and delete are supported in the results table
The UI is fully responsive and built in dark theme
🔑 Login Flow
Click Login to Salesforce in the extension. You’ll be prompted to:
- Select an existing connection (previously saved), or
- Start a new login.
If you choose a new login:
- You will be redirected to Salesforce’s login screen
- After authentication, you’ll be brought back and the connection will be saved with a friendly name
- This session is cached securely using the VS Code Secret Storage, fully cross-platform and managed by the editor.
🧼 Switching Orgs
Clicking Login to Salesforce again will allow you to:
- Choose a previously saved connection
- Or log into a new org
💡 After logging into a new org, the result table and loaded fields are automatically reset.
Upon successful login:
- The extension fetches all accessible Salesforce objects (via
/sobjects
)
- It loads the fields of each object in batches (15 objects at a time with delay)
- A counter like
233 / 2565 objects loaded
keeps track of progress
- After all fields are loaded, the sidebar collapses automatically
Objects are shown in a searchable, collapsible list with +/−
toggles.
Clicking a field adds it to the current query.
🧪 Query Editor
The query editor supports:
- Field suggestions after
SELECT
- Object suggestions after
FROM
- Multi-line support with nested fields like
Loan__r.Name
- Pressing Run Query fetches records and displays them in the result table
Queries are stored in a local history (max 20), accessible via the Query History button.
📝 Inline Editing
- Fields editable include: plain text, picklists, and lookups
- Lookup fields support typing
Name
or pasting a valid Salesforce ID
- Press
ESC
to cancel an edit and revert the value
After editing, the change is saved immediately via Salesforce REST API.
🧹 Mass Delete
- Use checkboxes on the result table to select records
- Click Delete Selected to delete them in bulk
- Deletion uses
DELETE
API calls on selected record Ids
- Supported only for top-level queried objects
🛟 Tips
- Use the Collapse All button in the sidebar to hide expanded objects
- Hover a truncated query in Query History to see the full text
- Use keyboard ESC to close popups or cancel lookup editing
- Multi-record delete works only if at least one row is selected
⚠️ Notes
- Field metadata (
describe
) is cached per session, but refreshed on each login
- If multiple
fieldsSuggestion
messages are received, the extension avoids double-counting using a Set
- The object and field list auto-highlights matches in the sidebar when filtering
- Lookup search only fires after typing 3+ characters
🛠️ Contributing
Pull requests welcome! Make sure to lint and test thoroughly.
📬 Feedback
If you find bugs or have feature requests, please open an issue on GitHub.
Built with ❤️ for Salesforce devs.