正解:B
Correct Syntax for SOSL Query:
Option B uses SOSL (Salesforce Object Search Language) to find records where the phrase 'ACME' appears in any field across multiple objects (Contact and Lead).
Syntax used in Option B:
List<List<SObject>> searchList = [FIND 'ACME' IN ALL FIELDS RETURNING Contact, Lead]; This query retrieves a list of SObject lists, where each inner list contains the results for a specific object (e.g., Contact or Lead).
Why not the other options?
A . Option A:
This uses SOQL (Salesforce Object Query Language), not SOSL. SOQL cannot search across multiple objects or fields. The syntax provided is invalid because SOQL doesn't support "multi-object WHERE conditions." C . Option C:
The Map<SObject> syntax is incorrect for SOSL queries. SOSL queries return a List<List<SObject>>, not a Map<SObject>.
D . Option D:
The syntax List<SObject> for SOSL is incorrect. SOSL must return List<List<SObject>> since the results are grouped by object types.
Reference:
SOSL Queries in Apex
SOQL vs SOSL