Skip to main content
Skip table of contents

Create a Nimble Query

Query Builder is a point-and-click tool for examining your Salesforce data in almost infinite combinations, displaying it in easy-to-understand formats, and using the resulting SOQL SELECT statement with AppExchange apps like Nimble AMS and customizations. Use it to set up new queries.

User Permissions Needed

Query Builder Admin permission set.

  1. In the tab bar, click 
    , or in Salesforce Classic, click 
    Nimble AMS, Staff View, Button, All Tabs
    .
  2. Click Queries.
  3. Click New.
  4. In Query Name, enter the unique name of the query you are creating. You can change this later by clicking 
     next to the query name.
  5. In Description, enter a description of where this query will be used and what it does.
  6. In Object, select the object containing the fields you want to appear in your query.

    In case you have two objects labeled similarly, the API name for each object displays after the object label.

  7. If the object has defined field sets, in Pre-Select Fields From Field Set, select a fields set(s) containing the fields you want added to your query to start. 
  8. Click Next.
  9. Select fields.

    Learn More...

    The Fields pane displays fields and field sets from the selected object. As you select individual fields and field sets, the fields are added to the Fields section. Learn more about Creating and Editing Field Sets (external). This is where you begin creating the SELECT statement of the query.

    1. In the Fields pane, select the Fields tab to select individual fields or Field Sets to select a field set, which contains multiple fields.
    2. Scroll or search to find the field or field set you want to add.
    3. Click

       to add a field or field set to the query. The individual field or all fields in the field set are added to the Fields section.

    4. To add an individual field from related objects, click

       next to the lookup field shared by the two objects. You will notice the Object Path displays at the top of the Fields pane, and you can either add fields from the related object, or click
       again to select a field on another related object. You can click an object name in the Object Path to navigate back to that object.

      You can navigate up to 5 relationships when building your query, which is the maximum allowed in a SELECT statement.

    5. To remove an individual field from the query, in the Selected Fields section, click

      , or in the Fields pane, click
      .

      To learn more about a selected field, hover over

      .

      You can also click

       to undo up to 5 field changes and
       to redo an undone field change.

      Like keyboard shortcuts? Click 

       next to
       to learn more.

  10. Optionally, add field filters.

    Learn More...

    The Filter section is where you can add conditions which filter down to results of the query you are creating. This is where you create the WHERE clause in your SELECT statement.

    1. In the Filter section, click

       to add a filter.

    2. In Field, scroll or search to find the field by which you would like to filter. If you select a field which relates to another object, you will notice another field displays where you can either select a field from the related object to filter by, or leave the field blank to filter by the originally selected field.

      You can navigate up to 5 relationships when building your query, which is the maximum allowed in a SELECT statement.

    3. When filtering by a date field, in Range, select a standard date range to filter by or select Custom to filter by a custom date range. When filtering by a standard date range, you will not have to select the Operation and Value.
    4. In Operation, select a comparison operator. The available comparison operators vary depending on the type of field by which you are filtering.
    5. Value is compared with the value in the field name, and functions differently depending on the type of field you are filtering by:

      1. When filtering by a checkbox field, select whether the value should be true or false.
      2. When filtering a pick list field, select a value.
      3. When filtering by a multi-select picklist field and using the contains any, does not contain any, contains all, or does not contain all comparison operators, select one or more value(s).
      4. For all other types of fields, enter the value.
    6. Click Save.
    7. Optionally, adjust logical operators.

      Learn More...

      When you add two or more filters, you can control how each is evaluated. As you add filters, a number displays next to each. You can use this number to set the order in which each filter is evaluated.

      1. In Filter Logic, you can update the logical operators—AND or OR. You can also use parentheses to define the order in which filters are evaluated. For example, the following expression is true if filter 1 returns a result and either filter 2 or filter 3 return a result:

        SQL
        1 AND (2 OR 3)
    8. If you want to remove the filter, click
      .
  11. Optionally, sort the results.

    Learn More...

    The Sort section is where you can set the sort order of the query results, such as by Last Name, ascending alphabetically. This is where you create the ORDER BY clause in your SELECT statement.

    1. In the Sort section, click
       to add sorting.
    2. In Field, select the field by which you would like to sort.
    3. Select Ascending or Descending
      to control the alphabetical sort order.
    4. If you want to remove the sorting, click
      .
  12. Optionally, limit the results.

    Learn More...

    The Limit section is where you can set the number of results to return, such as 5, which ensures the query runs quickly and returns only the first 5 results. This is where you create the LIMIT clause in your SELECT statement.

    1. In the Limit section, click + to add the limit.

    2. In Record Limit, enter the number of results you want returned.

      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.

    3. If you want to remove the limit, click
      .
  13. Preview the results.

    Learn More...

    Once you have created your query, you can preview the results to make sure it returns the data you want. The preview displays a limited number of records. Use the query within Salesforce to see all results.

    1. Click Preview.
  14. Copy the query to your clipboard or click Save to create a query record to use with an AppExchange app like Nimble AMS or a customization.

Nimble Query Automatically Copied to Custom Metadata Types

Once a Nimble query is created it will automatically be copied to SOQL queries in custom metadata types and hence will become deployable in newly generated orgs.


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.