SOSL (Salesforce Object Search Language)
Salesforce Object Search Language, a search language that performs text searches across multiple objects simultaneously using the Salesforce search index, supporting wildcards, operators, and returning records from different objects in one query.
Definition
Salesforce Object Search Language, a search language that performs text searches across multiple objects simultaneously using the Salesforce search index, supporting wildcards, operators, and returning records from different objects in one query.
In plain English
“SOSL (Salesforce Object Search Language) is a search language that lets you search for text across multiple objects at once using the Salesforce search index. Unlike SOQL (which queries specific objects), SOSL does full-text search across many objects in a single query.”
Worked example
A developer at Brackenwood Software needs to find any Salesforce record (across multiple objects) matching the search phrase "Acme Corp." Rather than running separate SOQL queries per object, he writes a SOSL query: FIND {Acme Corp} IN ALL FIELDS RETURNING Account(Id, Name), Contact(Id, FirstName, LastName), Opportunity(Id, Name). One round-trip returns matching records from all three objects. SOSL uses Salesforce's full-text search index - fast and capable of fuzzy matching - whereas SOQL is structured-query exact-match. SOSL is the right tool for global-search scenarios spanning many objects.
Why SOSL (Salesforce Object Search Language) matters
SOSL (Salesforce Object Search Language) is a search language that performs text searches across multiple objects simultaneously using the Salesforce search index, supporting wildcards, operators, and returning records from different objects in one query. While SOQL queries specific objects with structured filters, SOSL searches across the search index for text matches, making it the right tool for find-the-needle scenarios.
SOSL and SOQL serve different purposes and complement each other. SOQL is for structured queries against known objects ('give me all accounts in California'). SOSL is for text search across many objects ('find anything mentioning Acme'). Mature Apex developers know when each is appropriate and choose accordingly. SOSL results come organized by object type, with customizable RETURNING clauses controlling which objects and fields appear.
How organizations use SOSL (Salesforce Object Search Language)
Trains developers on when to use SOSL versus SOQL, choosing based on the search pattern needed.
Uses SOSL in their global search customization for finding records across multiple objects.
Combines SOSL with SOQL in their Apex code, using each where appropriate.
Trust & references
Straight from the source - Salesforce's reference material on SOSL (Salesforce Object Search Language).
- SOSL SyntaxSalesforce Developers
- SOQL and SOSL ReferenceSalesforce Developers
🧠 Test your knowledge
Q1. What is SOSL?
Q2. How does SOSL differ from SOQL?
Q3. When use SOSL?

Discussion
Loading discussion…