Using Workbench to Query Data

By in
724
Using Workbench to Query Data

One of the tasks that often comes up during client implementations at White Glove Consulting Group is data cleanup.  This is a broad category and can include schema re-design, new object creation, new field creation, data migration, and row-level data cleanup. Although there are a plethora of tools that can be leveraged to help in these processes, in this post, I will specifically review Workbench and how using Workbench to query data is a foundational step to data cleanup.

What is Workbench?

Workbench is a tool that was created by a former Salesforce employee. Like other ETL (Extract, Transform, and Load) tools, Workbench is not a native SFDC tool. To learn more about Workbench, view the Workbench “About” information here.

Connect Workbench

To access Workbench in your browser, go to https://workbench.developerforce.com. When you are at the login page of Workbench, it will ask you if you are working in a Production or Sandbox version of SFDC.

Workbench Environment

After you choose the Environment you are in, click the Login with Salesforce button.  If this is your first time using Workbench in the environment you’re logged in to, Workbench will request access to the SFDC environment.  This will require OAuth authorization to your environment.

Allow Workbench Access

Use Workbench for a Data Query

After you allow access, you can see the home screen shown below.  The main drop-down gives you access to all of the actions that are available in Workbench.  For this example, we will click the Queries tab and choose “SOQL Query”.

Workbench Queries

One of the nice things about Workbench is that even if you do not know any SOQL, you are able to build powerful queries that can help visualize and dissect the dataset(s) you’re working with.  Click the Object dropdown which will list any object you have visibility into in Salesforce.  For this example, let’s choose Account. Once you choose Account, all available fields display like the box below.

Workbench Account Object

From this stage, if you are familiar with SOQL you can directly type in a query in the box at the bottom of the page.  If you’re not familiar with SOQL, you can leverage field selection and filters inline.  An example of a query built using the in-tool options is below.

Workbench Query

This returns a List view of my results that meet the criteria of CreatedDate <= Today.  Any field I selected in the list on the left side of the screen becomes a column in my dataset.  Clicking the green plus button next to the filter allows me to add multiple filters if needed.

Finally, if you need your data in a CSV then you can select Bulk CSV under the “View As” option. Next, click query – a downloadable CSV is provided.

Continue learning about Workbench and strategies to update large datasets with, “Using Workbench to Insert, Upsert, and Update Data.

 

Additional Resources

Cover Photo by Heliberto Arias on Unsplash

Leave a reply

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