Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
QueryOptionsBuilder Class
Namespace
Usage
See the Usage section of the QueryOptions Class.
Example
This example chains Data 360 options on the builder and runs a DLO query.
1Database.QueryOptions opts = Database.QueryOptions.builder()
2 .withDataspace('default')
3 .withHonorEmptyStrings(true)
4 .build();
5
6List<sObject> results = Database.query(
7 'SELECT Id, EmailOptIn__c FROM CustomerProfile__dlm ' +
8 'WHERE EmailOptIn__c = \'\' SET OPTIONS :opts'
9);QueryOptionsBuilder Methods
The following are methods for QueryOptionsBuilder.
build()
Signature
public Database.QueryOptions build()
Return Value
Type: Database.QueryOptions
An immutable Database.QueryOptions object that reflects the current builder state.
withDataspace(value)
Usage
Use when querying Data 360 Data Lake Objects (DLOs). If a dataspace isn't specified for a DLO query, the query returns zero records. Valid only for DLO queries. Not supported for data model object (DMO) queries. For more information, see SOQL SET OPTIONS in the SOQL and SOSL Reference.
Signature
public Database.QueryOptionsBuilder withDataspace(String value)
Parameters
- dataspaceName
- Type: String
- The dataspace name. This parameter is case-sensitive. Can’t be null or empty.
withExplicitNamespace(bool)
Usage
If true, unqualified custom field and relationship names resolve to subscriber fields, and namespace-qualified names resolve to packaged fields. Use this option in managed package Apex to avoid field-name shadowing conflicts with subscriber orgs. Setting this option to false is the same as leaving the option unset, meaning that package namespace shadowing is applied. See Prevent Field Name Collisions in Managed SOQL Queries in the Apex Developer Guide.
Signature
public Database.QueryOptionsBuilder withExplicitNamespace(Boolean bool)
Parameters
- bool
- Type: Boolean
- true to enable explicit namespace resolution, or false for namespace shadowing. Can't be null.
withHonorEmptyStrings(bool)
Usage
Supported for Data 360 virtual entities (DLOs). Also supports simple queries for DMOs. Salesforce Platform objects don't distinguish between null and empty strings, so this option controls only Data 360 filter behavior. For more information, see SOQL SET OPTIONS in the SOQL and SOSL Reference.
Signature
public Database.QueryOptionsBuilder withHonorEmptyStrings(Boolean value)
Parameters
- bool
- Type: Boolean
- true to treat null and empty strings as different values, or false to treat them the same, which is the default behavior of Salesforce Platform objects.