On This Page

In This Section

Nimble Query

Nimble Query makes it extremely easy to build SOQL Queries. This section of Help explains how theNimble Query (NQ) package works and provides detailed information about how SOQL queries work for those who are new to it.

Query Basics

Queries let you filter your Salesforce data for specific information. With Nimble Query, you can examine your Salesforce data in almost infinite combinations, display it in easy-to-understand formats, and use the resulting SOQL query with AppExchange apps like Nimble AMS and Salesforce customizations.

Before building, reading, and using queries, review these basics:

Well-designed queries run faster.

Before building your query, consider writing down each question your query must answer. This way, your query is sure to return all the data you need.

Before building your first query, familiarize yourself with these features and concepts.

SOQL SELECT Statements

Salesforce Object Query Language (SOQL) is the query syntax used to search your organization’s Salesforce data for specific information. SOQL allows you to specify the source object (such as Account), a list of fields to retrieve, and conditions for selecting rows in the source object. SOQL query syntax consists of a requiredSELECT statement combined with optional filtering, sorting and limit clauses—WHERE, ORDER BY, and LIMIT—to return sets of data.

Query Builder

Nimble Query includes Query Builder, which is a visual, point-and-click tool which you use to create and edit queries without having to write SOQL query syntax. Query Builder is where you choose fields, filters, sorting, and limits that make up the clauses in your SOQL SELECT statement. You can either use Query Builder to create a SOQL SELECT statement, preview the results of the query, and save the statement as a query record which you can use with AppExchange apps like Nimble AMS and customizations.

To launch Query Builder, click New.

Show Me an Image...

Fields

One or more fields describe each query result. If you imagine your query as a table of information, then each row is a result and each column is a field.

For example, a human resources manager creates a query about employees. Each result is an employee, and each field is a different piece of information about the employee: first name, last name, job title, start date, and so forth.

When you create a query, you choose which fields you want to include. You can select single fields, or you can select a field set to include all the fields in that field set. Learn more about Creating and Editing Field Sets (external). To ensure your queries run quickly, it is a good idea to include only the fields you need.

Each field you add in Query Builder is included in the SELECT statement.

Filters

Limit the data that your query returns using filters. Filters are useful for many reasons, such as focusing your query on specific data, or ensuring that your query runs quickly.

For example, say your query returns all the cases in your company, but you only want to see cases which are open and assigned to you. Filter the query on the Owner and Status fields.

You can add multiple filters to your query, and specify in what order they should be evaluated.

For example, If you want to see cases which are open and belong to you or cases that are open and belong to a coworker on your team, you can add two filters, each using the Owner and Status fields, and specify the logic to use to evaluate one or the other.

You add filters in Query Builder, which become the WHERE clause in your SELECT statement.

Sorting

Order the data your query returns using sorting. Sorting is useful when the query results make more sense when some of the fields are given in a certain order.

For example, a query returns all new person accounts from this week, and you want to sort it by last and first name starting with A. Sort the query by the Full Name field in ascending alphabetical order.

You add sorting in Query Builder, which becomes the ORDER BY clause in your SELECT statement.

Limit

Put a cap on the number of results your query returns by setting a limit. Limits are useful when only a select amount of information is needed.

For example, you want the query to return the campaigns of which a particular account has been part. To keep the results from being overwhelming, you limit the query to return the first 5 results.

The maximum number of results Salesforce returns from a query is 50,000. We recommend you limit your queries in situations where there is potential to hit this limit as it provides a better user experience and can reduce query run time.

You add a limit in Query Builder, which becomes the LIMIT clause in your SELECT statement.

App

In the Query Builder app, you can search, navigate, and view queries in the typical in Lightning Experience.

Show Me an Image...

Permissions

To grant users access to view query records, assign them the Query Builder Read Only permission set. To allow users to create queries using Query builder, assign them the Query Builder Admin permission set. Learn how to Assign Permission Sets to a Single User (external).

Using a Query

After you build a query using Query Builder, you can either copy the resulting SOQL SELECT statement for use in Salesforce or save the query using the Query object and reference the record using Apex code.

Things to Keep In Mind

Front Line Support for Nimble Query is available to Nimble AMS customers. For questions and help, please reach out to Support either by email or phone.