function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jhartjhart 

minor bug: SOSL / "find" statements in Apex Code silently fails without namespace prefix

If you issue a SOSL search for a namespaced custom object in Apex code, you must fully specify the namespace prefix.

Omitting it, even if you are calling from within the same namespace, leads to a silent failure (an empty resultset)

The following code runs just fine, and both asserts succeed:

Code:
System.assert(0 != [find 'skipping' returning i__AALog__c (ID limit 10)][0].size());
System.assert(0 == [find 'skipping' returning    AALog__c (ID limit 10)][0].size());

 
The second statement should perform identically to the first.  If that's not possible, it should fail to compile.




patrospatros
More than a year later and this post is still helpful! I just ran into this with an app that we recently added to a beta package and was scratching my head for hours.