What is SOQL Query Builder in VS Code and How to use it?

SOQL Query Builder in VS Code

In this blog post we’ll learn a newly launched feature to execute the soql query builder in VS Code. This is really a great and interactive tool play around with soql and manipulate them without going into developer console.

Thanks to Salesforce and VS Code to introduce the community with a VS Code extension and making our life easier. This is not just a simple query tool but have some tiny awesome features too.

We have SOQL Query Builder now which is a VS Code extension and can be installed easily with few clicks. The extension facilitates us with rich and interactive UI for designing and querying the Salesforce connected org data.

Tip: Keep in mind that you have authenticated your org from VS Code

The soql query builder lets you query within VS Code rather than going to dev console. It also provides the soql query that can be used in apex code. The most advanced feature is the query result can be exported as json and CSV. This is something that workbench and query editor doesn’t have.

How to install the SOQL Query Builder in VS Code

Visit the VS Code marketplace and click on install. This will ask you to open the VS Code. Once opened just click on the install button to let it install itself. It can take few seconds but that’s really quick. It is highly recommended to restart your VS Code after the extension is installed.

Let’s now configure the Extension

Authenticate your org and set up project in VS code. Once all good you’ll see a scripts folder in the main project directory

VS Code Dir

This is where we can use the new feature of designing and executing query. In case you don’t see those folders these can be created manually.

Now create a new file contact.soql. Make sure to put the extension name as “.soql”. Now double click to open the file with VS Code

You’ll see this screen

SOQL Query Builder in VS Code

Now to open the UI Query explorer.

Right click on the contact.soql and select “Open With”.

SOQL VS Code Option

Choose the “Soql Builder” Option and query builder will be presented as

SOQL VS Code

You can select your Object, fields and other query operators from UI. Once all done click on “Run Query” to execute the query and get the result.

Tip: In order to open the file with “Soql Builder”. Make it default opening for the file.

SOQL Query Builder Result

You have now the result which can be exported as json and csv from button on top right corner.

That’s all. Post your comments if you have any thoughts and questions on this query builder.

Leave a Comment

Your email address will not be published. Required fields are marked *