Create a SOQL Query
A SOQL query is a record that searches your Nimble AMS org for a specific record or records. It is most commonly used to determine what records are returned by data sources, or to determine if a query-based access control is true or false.
As of Spring '19, queries are now stored as Custom Metadata Types (CMTs) instead of sObjects. This makes it very easy to move queries from staging to production and to include it in packages. While the Queries tab still exists (which creates sObject queries) and is fully supported, we recommend creating CMT queries from now on. This page explains the new, recommended method (creating CMT queries).
- In Setup, go to Custom Metadata Types
- Locate SOQL Query and click Manage Records. Click New.
In
Label
, enter an easily recognizable term to identify this query.- In
SELECT
, enter the fields you want returned by your query, separated by a comma. - In
SObject
, enter the name of the object from which you want the fields queried. Optionally, in
WHERE
, enter the conditions that must be met in order for records to be returned by your query.If you have multiple Community Hubs, keep in mind whether the SOQL query should filter for only records associated with the entity(s) for the Community Hub in which this SOQL query will be used, or if you want to return records from all entities. To return only records for the current entity, include
Id = {!CurrentEntityId}
in the WHERE clause.- Optionally, in
ORDER BY
, enter how you would like the resulting records to be ordered. Optionally, in
LIMIT
, enter the number maximum number of records to be returned by your query.LIMIT
is set by default to 50,000, which is the maximum number of results Salesforce will return to a query. It's recommended that you set the value to 50,000 or below, since there will be an error if more than 50,000 results are found.