Skip to main content

Query

Query module of Brobench provides highly sought after capabilities to help with writing queries, view results, create favourite queries and recall query history for easy re-execution.

Query module includes the following major capabilities

  • Write queries
  • Content Assist
  • Field insights
  • SOQL Enhancements
  • Query Execution
  • View Records by Ids/Values
  • Child queries
  • Query Templates
  • Query History
  • Favorite Scripts

Overview

There are a lot of things in the Query module, and the below screenshot highlights many important aspects. Each of these features is explored further in the below sections.

Basic Usage

The most basic usage is to author query and execute it. To do that goto Query Editor, write or paste the query and click on Execute button. Once executed, results will be shown in the below section. At this time, Query Results don't allow you to edit the records but that capability will be added in future versions.

Once results are shown, you can explore the results. Search for particular record by entering search term in Search in Grid input box. If there are a lot of fields, you can filter fields by entering search term in Filter Fields input box. You can resize the columns by dragging the end of fields and dragging to make it wider or narrower. You can re-arrange fields if you want to see specific fields together.

If your query matched more records than shown in the Grid, Fetch Next Batch button would be enabled. Clicking on that button, the app will fetch the next batch of records.

If you want to hide some fields based on some criteria, click on the Filter fields by Criteria button where you can choose the type of fields to hide.

Query Editor

Writing queries is as easy as it gets in Brobench. Features like Content Assist of Objects/Fields/Picklist Values and Query Templates can significantly reduce the amount of time it takes for you to author a correct query without errors.

To author, goto Query editor and start typing the query. The first thing you notice is auto-complete showing Query Templates like below. Query Templates are re-usable pieces of Query that act like a template of actual Query that would want to write. Select a snippet or just continue typing what you intend to type, and the app will continue to prompt auto-complete suggestions based on context.

Once you got the query, you intended next step is to execute. See Executing Query for various ways to execute the Query.

Query Comments

Brobench supports both single line comments //... and multi-line comments /*...*/. You can select the query text including comments and query executor will ignore the commented piece of the query and execute the rest.

You can use shortcut Cmd+/ or Ctrl+/ to toggle the single line comment of current line

Query Editor Minimap

Editor Minimap is a strip on the right side of the editor that shows an overview of editor contents. You can also use that as scroller to navigate to part of the editor.

Query Editor Regions

Brobench uses a single Query editor with auto-save feature so you don't have to switch between multiple editors. However, this can lead to a lot of queries in single view and can be overwhelming to navigate. To facilitate identifying area of editor with friendly name, Query Editor supports Editor Regions.

An editor region is block of code separated between // #region <optional name> and // #endregion. As you can see, it is just a convention on top of single line comments feature.

Regions add the following capabilities

  • You can fold a region to collapse its contents so reduce the visible contents
  • Regions show up in the editor minimap on the right side with increased font-size
  • They also show up in Query Outline view for listing all regions and search for one

Here is an example of how regions can be defined and how they show up in Minimap and Query Outline.

Content Assist

Brobench supports content assist of

  • Objects
  • Fields
  • Parent Fields
  • Child Fields
  • Picklist Values

Those resources are shown in the following parts of the query

  • Select
  • Child Query
  • From
  • Where
  • Having
  • Order By
  • Sub Query

Since From <object> is essential to know the Object which defines the context, it is advised to enter select from <object> first and then compose rest of the query. This way, the app can fetch and show the appropriate list of values.

App should pop up the suggestions as you compose the query. If for whatever reason suggestions are not shown, you can request the suggestions by entering Ctrl+Space shortcut.

Here are some examples of various ways of Content Assist.

Objects

Fields

Parent Object Fields

Child Relationships in Child Queries

Child Object Fields

Picklist Values

Query Outline

Query Outline feature shows you a tree with summary of various statements in the editor. You can search or navigate for Query of your interest and then go to that Query starting position by selecting that node in the Outline Tree. If you have used any of the modern code editors, you would feel right at home using this feature.

Note that Outline also treats the comment just above the query as description for that query and shows that description in the Outline view. For ex.,

When you are in the editor, user shortcut Cmd+O (Mac) or Ctrl+O (Windows) (that is letter O, not zero) open the Outline. It shows a dialog as shown below. You can search for some text of your choice and select the item to go to start of that selected item.

Note that at this time we show only selected fields and object name details in the Outline item. More details may be added depending on the user feedback.

Other Editor Features

Brobench uses the widely used editor component from VSCode, hence following editor capabilities work as they do in VS Code. Note that other VS Code editing capabilities not listed below are not supported.

Query Builder

Query Builder helps you build SOQL queries by point and click. It is a great way to get started to build a query evev if you want to use Editor to enhance or execute it.

To access the builder, click on the Builder tab next to Editor tab. Here is the video guide on how to use the feature.

Query Builder Overview

Query Builder Usage

Here is the typical Query Builder usage.

  1. Select the Object that you want to query from
  2. Select the Core, Parent and Child fields you want to fetch
  3. Specify any Where condition as appropriate
  4. Specify any Order By fields as appropriate
  5. Select Other Options including Limit, Offset or if you want to show deleted records
  6. Click Execute button

Toolbar Actions

Here are the various actions in the toolbar in the Order. Hover over an icon to see brief tooltip on what that action does.

ActionDescription
Refresh FieldsRefreshes list of Objects and selected Object from Server
FilterAllows you filter fields that are shown in the Fields Picker Panel
Collapse FieldsCollapses any Tree Nodes to initial view
Reset Fields SelectionResets fields select to initial state
Open Settings DialogOpens Settings dialog. See below for more information

Where Clause Operators and Values

Most of the operators and value selection shown in the Query Builder is pretty straight forward so we will cover only things which are not obvious or need to be explained.

Field TypeOperator/Value TypeDescription
AllInEnter multiple values each in a new line. App will construct In Clause appropriately
Date/DateTimePickerWhen Value Type is Picker, it shows Date or Date Time picker depending on the field type. If it is Date Time, it is select in Brobench Timezone or Connection timezone.
Date/DateTimeLiteralShow list of Date related literals. If you select any of N literals like LAST_N_DAYS, then you can enter the N value as well.
Date/DateTimeRelativeAllows you enter date/datetime value relative to current date. See below for More Info.
Date/DateTimeRaw InputLets you enter the Date or DateTime value that should be used. Entered value must be in ISO format

Where Clause Relative Date Format

If you select Relative as the value format for date fields, then you can enter it as follows.

[-](<number><unit>)+

Where number is any positive integer and unit is any of date unit y=Year, M=Month, d=Day, h=Hour, m=Minute, s=Second. Note that Month is upper case M, whereas minute is lower case m

Here are some examples, assuming current time as 2024-10-07T18:26:04Z

  • 5m => 2024-10-07T18:31:43Z
  • -5m => 2024-10-07T18:21:54Z
  • -3d 5m => 2024-10-04T18:22:11Z
  • 3d 5m => 2024-10-10T18:32:23Z
  • 2y 3M 4d 5m => 2027-01-11T18:32:48Z
  • -2y 3M 4d 5m => 2022-07-03T18:23:00Z

Query Builder Settings

Query Builder Settings allow you to customize some behavior of Query Builder. Click on the Cog icon to open the below dialog.

FieldDescription
Default ObjectSelect the default Object that should be shown when you navigate to Builder. If you select Specific Object, it will show Input Box to enter that Object API Name
Auto Add FieldsSelect or more checkboxes to indicates which fields you need to add to Generate Query by default. "Name" field will add fields like Name, Title, Subject, Label, CaseNumber etc., Record History adds child query to select record history.
Default LimitIf you specify a Limit, this limit is selected by default in the Builder. This allows you to experiment query and then when it is working, you can remove the limit to execute to match all records
Fields Picker Display ModeIndicates how fields are shown in the Fields Picker Panel as well as Dialog. Core/Parents Together shows the Core and Parent fields together and child fields at the bottom. All Together shows all 3 type of fields together. All Separated shows Core fields first, then Parent fields and then Child Fields.

SOQL Enhancements

Brobench provides the following enhancements on top of Salesforce SOQL query language.

Wild Card Fields

While Salesforce provides fields(all)/fields(standard)/fields(custom) constructs to fetch all fields, it comes with many limitations with critical one being you cannot fetch more than first batch of records with it and others.

To overcome these issues, Brobench wild card selection of fields is a more versatile and capable enhancement as outlined below

  • Use * by itself to select all fields. For ex., select * from account. Note that if there are a lot of fields in that object, that construct will only include the first 600 fields.
  • Use * anywhere in a field to match by prefix or suffix or contains.
    • select *street from account will select both BillingStreet and ShippingStreet
    • select billing* from account will select all fields starting with Billing
    • select *name* from contact will select all fields containing Name like FirstName, LastName, Name etc.,
  • Use wild card multiple times
    • select billing*, shipping*, *street* from account will select all fields starting with either billing or shipping. If a field is matched by one or more matchers, then that field is included only once.
  • Use * with specific parent prefix to select matching fields in that parent object
    • select Id, *name*, Account.billing* from contact will select contact id, contact fields containing name and its account fields starting with billing
  • Use * in child queries
    • select Id, name, (select * from contacts) from account limit 100 will select id, name for Account and all fields of Contact.

All Rows Clause

Salesforce allows you to include All Rows clause when you run the query in Apex language context. This clause shows all records, including deleted/archived records. This clause doesn't work outside of Apex Language context.

Brobench provides language enhancement to parse all rows clause and if specified, query SOQL with the Include Deleted option.

Note that you can also query to show deleted records by executing query using Execute as Include Deleted option. See Execute Other for more information.

bb_fields Function

bb_fields is a special soql function, designed after soql standard function fields but with enhanced capabilities.

Function syntax is bb_fields(arg1, arg2, ... argN) where each arg indicates a set of fields to be matched.

  • all: This is similar to the standard function fields(all), which includes all fields. Note that this is same as select * from.
  • standard: This is similar to the standard function fields(standard), which includes all standard fields
  • custom: This is similar to the standard function fields(custom), which includes all custom fields
  • type_<Field Type> where Field Type is field type. All possible values are shown below.
Argument ListArgument ListArgument ListArgument List
type_addresstype_multipicklisttype_datetimetype_rollup
type_autonumbertype_numbertype_emailtype_text
type_booleantype_percenttype_formulatype_textarea
type_currencytype_phonetype_locationtype_textarealong
type_datetype_picklisttype_lookuptype_textarearich

For ex.,

  • select bb_fields(type_lookup, type_date) from account; selects all Lookup and Date fields from Account
  • select bb_fields(type_lookup, custom) from account selects all Lookup and Custom Fields from Account;

Execute Query

There are three ways to execute a query that you have authored.

  • Click on the Execute button in Query Editor toolbar
  • Right-click on the query text and select Execute menu item
  • Press keyboard shortcut Cmd+Enter/Ctrl+Enter

The query to be executed is picked in this order

  • If you have selected any part of the query, only that selected text will be executed.
  • If you haven't selected any text, then the paragraph around the current line will be used. The paragraph is identified by blank line on above and/or below current line. If the current line is blank line, then the paragraph below current line is executed. If the current line is blank and there is nothing else after that line, then nothing will be auto selected.

When you execute a query, result tab will be opened nad results or error will be shown. See Query Results for more information on how to navigate around the results

Query Types

Query Editor supports executing a different type of queries, primary one being SOQL query. It also supports SOQL Chain Queries and SOSL Query

SOQL Chain Queries

SOQL Chain Query is where you run a Query, take the results and feed it into the second query, which can refer to first query details via Query Variables and so on. SOQL Chain unlocks quite a bit of capabilities and allows you to query data which otherwise is really laborious to achieve.

For example, Let's say you have a query select Id, Billing_Account__r.Account__c from Contract__c which is returning list of contracts and its corresponding Billing Account. Now you want to get details of those accounts its corresponding child entities, you cannot do with native SOQL as the following SOQL query will error because it is not a valid Sub Query construct

Select Id, Name, (Select Id, Name from Contacts) from Account 
where Id in (Select Billing_Account__r.Account__c from Contract__c)

With SOQL Chain, you can achieve this as follows.

Select Billing_Account__r.Account__c from Contract__c
chain
Select Id, Name, (Select Id, Name from Contacts) from Account where Id in (:Billing_Account__r.Account__c)
info

Keep these things in mind when you are working with SOQL Chain queries.

  1. It batches 250 records from the previous query and feeds into the next query
  2. It executes the query before, keeps the records in memory and then executes the next query
  3. If any of the queries returns no records, then the final result will be No Records
  4. Query variables are case-insensitive. For example, below query variable references behaves the same.
Select Id, Name from Account where Id in (:Billing_Account__r.Account__c)

and

Select Id, Name from Account where Id in (:billing_account__r.account__c)

  1. You can use Query variables in the first query which and if so, app will prompt you to enter those query variable values

Another great example of SOQL Chain use-case is querying from Event/Task and corresponding Parent Records without having to resort to Polymorphic Queries.

select WhatId from Event where WhatId != null limit 1000
chain
select * from Opportunity where Id in (:whatId)

SOSL Queries

Query editor supports authoring SOSL Queries and executing them as you would a SOQL query. Type up the SOSL Query and execute it.

caution

Keep these things in mind when you are executing SOSL.

  • While Query editor supports all aspects of SOSL query authorizing including With Snippets and With Highlights, the results shown are not highlighted in the grid. This is due to how the data grid rendering works and data as returned from Salesforce.

Here is an example of how to execute SOSL query, view results and modify them.

SOSL Query Auto-Complete

SOSL Query is used to search data in Salesforce using various conditions.

Query Editor supports SOSL Queries with auto-completion for Objects and Fields, and all clauses of SOSL Queries. If auto-complete is not working in particular SOSL clause, please create a bug and will address it.

SOSL Query Pre-processing

If you include an object in the query but do not specify specific fields, then app automatically includes Record Preview Fields for that object.

For ex., if you execute query

find {test} returning Account,

it actually runs this query behind the scene (list of fields may vary based on Record Preview Fields configuration)

find {test} returning Account (Id, Name, CreatedById, CreatedBy.Name, CreatedDate, LastModifiedById, LastModifiedBy.Name, LastModifiedDate).

This enables you to see more context around matched records than just the Id that Salesforce returns by default.

If you do include any field in that object, then Preview Fields are not added. For ex., if you run find {test} returning Account (Id), then that query is executed as is.

Viewing SOSL Result

When you execute a SOSL Query, if there are multiple objects returned from Salesforce, then a sub-tab is shown for each of the results. Each tab shows matched records for that single Object as shown in the Tab title.

Each tab is a fully functional Data grid that you can search in grid, filter columns, edit/save, and export as usual.

Query History

Every time a query is executed, it is added to Query History MRU (most recently used) lis along with execution time and execution count. You can view this history by clicking on the 'Click' icon in the Query Editor toolbar.

Favorite Scripts

If you have a set of queries that you often run, you can save them as Favorite scripts and execute them with ease.

Top 10 scripts (sorted by name) are shown in the dropdown which can be accessed by clicking on the Triangle Down button next to Star icon.

They are also shown in the Global Bookmark menu along with Objects/Records etc.,

Favorite Scripts can contain Query Vars.

Managing Favorite Scripts

To manage Favorite Scripts, click on the Star icon in the Query Editor toolbar which should show the below dialog.

Add/Edit Script

To add click the Plus icon or to edit click on the Pencil icon next to script you want to edit. It should show dialog with the following fields. Enter the values and click Save.

FieldTypeDescription
NameString (100)Name of the script. This is shown in the Fav Scripts/Global menu.
TypePicklistType of script. As of now, it is Query but later we will support Apex script as well.
DescriptionText Area (1000)Any description to help you understand the script
ConnectionsPicklistIf this Query is applicable to only set of connections, then you can select that connection list. If so, this script will be shown in the dropdown only for those connections
FolderString (1000)Folder to organize the scripts. You can enter folder tree segments separted by /. For ex., Monitoring/Accounts
ScriptStringActual script

Delete Script

Click on the Trash icon next to the script you want to delete. After confirmation, the script will be deleted permanently.

Query Templates

Query Templates feature allows you to configure custom reusable soql statements with dynamic placeholders. These snippets show up as Content Assist suggestions. When selected, the app inserts a specified template into the editor and allows you to change placeholder values. Brobench comes with many standard snippets, so you can get started immediately.

Template Usage

Dynamic placeholders are indicated by ${n} or ${n:Default Value} where n is an integer starting with 1 and Default Value is the default value for that placeholder. Value 0 indicates final cursor position after all dynamic placeholders are navigated.

When a snippet is inserted into the editor, it will navigate you from placeholder position 1 and onwards. To go to the next placeholder, click Tab. You can also escape (esc) to abandon dynamic placeholders.

For ex., if this is the snippet content select Id${2} from ${1} where ${0};, when inserted into editor it will look like below

  • First, it will focus on the cursor after from keyword as that is placeholder ${1}. You can enter object name and click tab
  • Next, it will focus cursor next to Id field. If you want to add more fields, type those fields. Otherwise, just press Tab
  • Next (and finally), it will focus next to where keyword and concludes the dynamic placeholders as this is the final cursor position with value ${0}

List Query Templates

Click on the Query Templates icon (see Overview for location of the icon). When clicked, it shows the following dialog.

It shows both standard snippets and custom ones. Standard snippets cannot be edited or modified.

Add/Edit Query Template

Click on + icon in the toolbar to add new snippet or click on Pencil icon next to a custom snippet to edit it. It shows the dialog where you can enter details. The following table shows the fields shown in the dialog.

FieldTypeDescription
NameString (100)Name of the snippet which shows up in the Content Assist list of suggestions. Keep it brief and unique.
ContextPicklistThe context where this snippet should be used. Depending on the context, suggestions are filtered.
DescriptionText Area (1000)Any description to help you understand the snippet
ActiveBooleanIf Snippet is inactive, it will not be shown in the suggestions
ContentString (4000)Content of the snippet. As outlined in Snippet Usage you can include dynamic placeholders with optional default value

Delete Query Template

You can delete the snippet by clicking on Trash icon next to custom snippet. App will delete the snippet after confirmation.

Query Variables

Query Variables enables reusing a same query with different values in Where clause. Query Variable is defined as :queryVarName, which is similar to how they are defined in SOQL queries Apex language.

caution

Note that Apex allows you to add space between : and variable name but Brobench parser engine doesn't support that. For ex., : accountId is valid in Apex SOQL but is not valid in Brobench

Each Query can contain more than one variable. For ex., select * from account where name like :name and accountnumber = :mainAccountNum

Each variable can be used multiple times ex., select * from account where name like :name or parent.name like :name

When you execute a query with variables, the following dialog will be shown. Enter the values and then press Execute.

Query Vars in In clause

Query variables can be used in In clause. In such cases, the dialog will show input text area. Entered text will be split by new line, and each line is fed as single in clause value.

For example., for given query select id, name from account where accountnumber in (:accoutNums) and entered Query Var value of

123
456
789

then it will create the query select id, name from account where accountnumber in ('123', '456', '789')

Paginated Query Vars

If you are using a variable in in clause and that query values when added to a SOQL Query exceeds maximum length of soql, you can make use of Paginated Query Vars feature. This feature splits the values you enter into batch of 250 or so values, queries for records, and combines the records with id match.

To enable Paginated Query Var, turn on Paginate switch as shown below.

Query Vars value history

Each query var, entered value will be persisted (except if query variable is used in In clause) and they can be recalled by the dropdown control as shown below

Saving Queries

Query editor auto saves the text you enter every once in a while as well as just before you execute any query. If you would like you can force save by clicking on the Save icon in the Query Editor

caution

If you have multiple tabs open, and editing the text in both places, it may not sync properly. If you do see the query you entered is not in the editor next time you open it, you can recall from the Query History

Execute Other

Execute As options provide different ways to query the data you're looking for. These options can be accessed by clicking on the dropdown next to Execute button as shown below

Execute with Include Deleted

This option executes the query to include the deleted records. Note that you can also query to include deleted records using All Rows clause. Deleted records would be included when this option is selected or if query has All Rows clause hence you need not do both.

Execute as Count Query

Many times during the data analysis, you would want to see the count of records a query matches. You can do that in two ways 1) Run the query as is and see the total records matched 2) Change the select clause to count() and run the query

Both of them are not an efficient approach to get the records count. In the first case, it fetches the data unnecessarily and might also keep the pagination cursor open on the server side. In second case, you need to change the query to replace select fields with count() and revert back to include fields afterward.

Execute as Count Query option automates the second option. Upon execution, app replaces the select fields in memory with count() and shows the result.

Execute as Polymorphic Query

Polymorphic Field is a field that can look up to more than one Object. For ex., Task.WhatId, Event.WhatId or Attachment.ParentId etc.,

If you want to fetch related parent record information, you cannot use typical SOQL relationship names as those names may not be valid in all Objects that Poly Field can point to. Instead, you must use Poly Field clause in SOQL.

For ex.,

SELECT 
TYPEOF What
WHEN Account THEN Phone, NumberOfEmployees
WHEN Opportunity THEN Amount, CloseDate
END
FROM Event

Brobench supports executing those queries fine. However, it is painful to construct such queries. Execute as Polymorphic Query automates construction of Type Of clause behind the scene.

For ex., if you run select Id, What.Phone, What.NumberOfEmployess, What.Amount, What.CloseDate from Event, via the above option, app transform that query to above Type Of clause and executes it.

Execute via Bulk API

If you have a Query that matches a lot of records, it can take time to download all of those records via Batch API, which is the default API that Brobench uses. Execute via Bulk API, will change underlying api to Bulk API V2. App will do all the heavy lifting behind the scene and shows the first batch of results, up to 50k. You can continue to fetch the next batch of 50k records till results are exhausted.

Execute via Tooling Api

App automatically uses Tooling API if you are querying a Sobject which is available only in Tooling API. However, there may be objects that are available in both Partner Api and Tooling API, and in such cases, the app will use Partner API by default. If you want to force the app to use Tooling Api, execute the query with Execute via Tooling Api

Execute Query in Clipboard

If you have copied a query from somewhere you want to execute, you don't need to paste into an editor, select and execute it. Click on Execute Query in Clipboard, which will save you some clicks.

Query Records by Ids

This option helps you view the records by set of ids or extracted ids from blob of the text. When you select this option, it shows the following dialog.

Enter ids or text containing ids and click View Records. The app will extract the ids and view those records.

Please keep these points in mind when you use this feature.

  • You can enter ids that belong to different objects. The app would group by the object and show multiple result tabs, one for each Object
  • You can enter blob of text and in such cases, app would try to extract the ids and show the result

Query Records by Ids in Clipboard

This is the same as Query Records by Ids which automatically uses the text in clipboard

Query Results

When you execute a query, results are shown in the bottom panel of the Query Tab as a new result Tab. The following screenshot highlights various parts of the query result.

Refreshing Results

If you want to refresh the results, click on the Refresh icon, which will re-execute the results and shows the first batch of matched records. You can fetch more batches using More Batches action.

info

When you Refresh the results, it re-executes the Query that was initially executed. If you have made changes to the Query in the Builder/Editor, it will not consider that change. If you really want to execute the latest query from Builder/Editor, close the result tab and re-execute again from the Builder/Editor.

Filtering Columns

Sometimes you would query a lot of columns (especially with select * construct) and you have too many columns to deal with. You can hide some of those columns by filtering out columns via Filter (funnel icon). By default, all the columns will be shown, but you can hide one of more type of columns by selecting appropriate options.

Note about Null Fields. That option hides a column if and only if all records shown in the grid have null value for that column. This doesn't take into consideration the batches of records which haven't been retrieved from the server.

Auto Refresh Result

If you are kind of monitoring a data set which is changing, and you want to refresh the results every so often, you can leverage the Auto-refresh Result feature. To enable, click on the Auto-refresh button and select the time interval when the Data should be refreshed. To cancel, click on the same button again.

Data cells formatting

Brobench has deep understanding of all fields included in the SOQL, and it uses that information to format the data as appropriate.

  • Null values are indicated by cells with a Grey background
  • Id/Lookup/Master Details reference fields are shown as hyperlink and when you hover, it will show the preview
  • Date time fields are formatted according to the Brobench or Sfdc Connection user timezone

Result Status

Datagrid shows the status of the query execution and it looks like this. For ex., below status is conveying that there are 19 records matched/fetched, query included 67 fields and Salesforce Query API took 153ms to complete the execution.

Fetching Next Batches

Salesforce returns the first batch of records for a given SOQL. The number of records returned in a batch depends on the complexity of the SOQL, data type of fields and also the number of fields queried. It can return anywhere between 1–2000 records.

Brobench by default shows the first batch of records and shows the total number of records matched in the status field as follows. For ex., below status is indicating that there were 172,947 records matched, but Salesforce returned 250 records in the first batch.

In such cases, Fetch next batch icon should be enabled. Click on the icon to fetch next batch or click on the Dropdown icon next to Next Batch, which provides the list of options to fetch many numbers of batches at a time.

As you fetch the next batch of records, retrieved batches should be added to the same grid so you can Search in Grid or export all fetched rows easily

Export Result

caution

Note that Grid exports only the records that have been fetched from Salesforce. If you SOQL matched 10,000 records but you have fetched only the first of batch 2,000 records, then when you export all records, it will export only 2,000 records.

To be able to export all, first fetch all records and then export.

To Export Data, right-click on the Datagrid, and select Export Other sub-menu as shown below

There are various options to control what data is exported and target location/format. Select the appropriate Option, which should allow you to either download that file or export to external target like Gsheet.

Copy Data

If you want to copy the data instead of export, select Copy or one of the available options in Copy Other.

Edit Data

If the Sobject and result you are viewing is editable, then Edit button will be shown in the toolbar. Click on the button to enter Edit mode. When you enter edit mode, the toolbar will show additional buttons as shown below.

Once you are in the edit mode, you can double-click on a cell and change/enter new data. You can bulk modify cells by selecting all cells you want to modify, set new values via Edit Menu.

Go through this quick video guide on how to bulk edit data.

Edit Menu

You can access the edit menu by clicking on the Pencil icon in the toolbar or by right-clicking on the grid and select Set, which are as shown below.

Edit menu from Toolbar

Edit menu from Grid right-click

Most of the options are self-explanatory with details for specific options is shown below.

New Value: When you select this option, the system will prompt you to enter a new value and that value is set to all selected cells.

Find/Replace: When you select this option, the system will prompt you to enter a string to search for and string to replace with. String to find is required but string to replace is not. If you don't specify one, then it will be replaced with blank.

Turn on Match Whole Cell to match complete contents of the cell otherwise it will match partial matches.

Edit Other Options: Typically you would want to set new values to selected cells. However, sometimes you want to set to whole column or set only blank or non-blank cells. You can access these options by selecting appropriate options in the Edit menu.

Picklist Values: If you select cells in a single column and if that column is either Picklist or Multi-picklist, then the Edit menu shows the available picklist values which you can easily select from as follows. If it is multi-picklist, then it provides options to set new value, add to existing values or remove from existing values.

Saving Data

Once you made all necessary changes, you can click on the Save button in toolbar. It will prompt you with a message showing how many changes are being saved. Confirm the prompt, and after that Grid will save the changes to Salesforce, and Grid will come out of Edit mode. If you want to make further changes, goto Edit mode again and repeat the process.

Troubleshooting Save Errors

If there are any errors while saving the data, then record background color will change to red and _Error column will show the actual save error for that record. You can sort by _Error column to sort all error records together to view all messages. Correct any of the data issues and Save again.

Viewing Child Query Result

If you execute a SOQL containing a child query, then Datagrid will show those child results as sub-result tabs for each of the child-query, up to 5 levels.

When you select one or more parent records, then child records corresponding to those parent records are shown in child grids. Parent record Id and (Name if selected) will be shown as first column in the child grids. You can edit the child results as you would the main result.

Resize the Result Panels

SOQL Results are shown in resizable splitter which can be adjusted to make Datagrid bigger or smaller. This also works for Child datagrids.

Maximize Result Tabs

You can double-click on a Result tab label to maximize the result so that you will have big real estate to view/edit the data. Double-click again to restore back to its original size.

Pin Result Tabs

By default, a Tab will get re-used to conserve memory if it is not in edit mode and if its Object name matches the query being executed. If you want to keep the tab from being reused, you can pin the tab. There are two ways to pin/unpin the tabs.

  1. Cmd+Click/Ctrl+Click the Tab label
  2. Right-click on a Tab label which should show the Tab menu which provides options to Pin and Unpin a tab.

Once a Tab is pinned, Close icon is changed to Pin icon and it cannot be closed until it is Unpinned.