Plat-Dev-201 practice question 10 of 30
(Full question statement) Which statement generates a list ofLeadsandContactsthat have a field containing the phrase "ACME"?
Full set: 204 questionsTo search for a text phrase across fields in multiple objects like Lead and Contact, Salesforce Object Search Language (SOSL) is required. The correct syntax is FIND 'searchterm' IN searchgroup RETURNING sObjectlist. Option C correctly uses FIND 'ACME', specifies searching IN ALL FIELDS, and lists the objects to RETURNING. The return type for a multi-object search is List<List>.
A. The IN FIELDS clause is not a valid search group in SOSL syntax. Valid options include ALL FIELDS, NAME FIELDS, EMAIL FIELDS, or PHONE FIELDS.
B. This is invalid SOQL syntax. A single SOQL query cannot have multiple sObjects in the FROM clause in this manner.
D. The return type is incorrect. When a SOSL query returns more than one sObject type, the result is a list of lists (List<List>), not a flat list (List).
1. Apex Developer Guide, "Introduction to SOQL and SOSL", section "SOSL Syntax". It details the structure: FIND 'searchQuery' [IN searchGroup] [RETURNING ObjectsAndFields].
2. Apex Developer Guide, "Executing a SOSL Query". This section clarifies the return type: "The result of a SOSL query is a list of lists of sObjects... Each list contains the search results for a particular sObject type."
3. SOQL and SOSL Reference, "FIND (SOSL)". This document provides examples and defines the valid searchGroup values, which do not include IN FIELDS.
Keep practicing
Take the free Plat-Dev-201 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other Plat-Dev-201 practice questions
- Question 1Which three steps allow a custom Scalable Vector Graphic (SVG) to be included in a Lightn…
- Question 2Which two statements are true about using the @testSetup annotation in an Apex test class…
- Question 3Managers at Universal Containers want to ensure that only decommissioned containers are a…
- Question 4Universal Containers has a Visualforce page that displays a table of every Container__c b…
- Question 5A developer is alerted to an issue with a custom Apex trigger that is causing records to …
- Question 6Which two operations affect the number of times a trigger can fire? Choose 2 answers
