← back to the release
new featureApex

Resolve Field Name Conflicts in Managed Package SOQL Queries

Managed Apex dynamic SOQL can now disambiguate a package field from a subscriber's identically named custom field by building a Database.QueryOptions object with withExplicitNamespace(true) and passing it as a bind variable in a SOQL SET OPTIONS clause. With the option set, an unqualified field like Age__c resolves to the package's namespaced field (ExPackageNS__Age__c) instead of failing the duplicate-field-name rule enforced since API 34.0. Queries without SET OPTIONS keep their existing behavior.

identifiers
Database.QueryOptionswithExplicitNamespaceSET OPTIONSDatabase.queryDatabase.queryWithBinds
flags
enabled by defaultno action required
how
Build Database.QueryOptions with .withExplicitNamespace(true) and pass it as a bind var in the SOQL SET OPTIONS clause.
who
Managed package developers.
when
where
Enterprise, Performance, Unlimited, and Developer editions.
read it on salesforce.com