0

I'm trying to SOSL search ApexClass below.

FIND {MyTestClass} IN NAME FIELDS RETURNING ApexClass(Name)

The Name on ApexClass is a name field. Why this SOSL query has no record returned?

1
  • Why use SOSL here? To find Apex classes, you likely want exact rather than fuzzy or partial matches so SOQL seems a better fit. You also should not have any concerns over use of Shield even for it could be applied to Apex classes since you are doing an exact match.
    – Phil W
    Jan 29, 2021 at 7:26

1 Answer 1

1

The SearchGroup scope you mention in Name Field can work only in Standard Object.

Try this SOSL:

FIND {myTestClass_Test} IN ALL FIELDS RETURNING ApexClass(Name)

Ref Link: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl_in.htm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.