While preparing for DEV450 I got below question in one of the sample test

What is the data type returned by the following SOSL search? [FIND 'Acme*' IN NAME FIELDS RETURNING Account, Opportunity];

A - List<List<Account>,List<Opportunity>>
B- Maps<sObject,sObject>
C- Map<Id,sObject>
D- List<List<sObject>>

My asnwer was D but answer provided by test was B, can someone please explain whats the correct answer?


You can confirm that it is D by running:

Object o = [FIND 'Acme*' IN NAME FIELDS RETURNING Account, Opportunity];
System.assert(o instanceOf List<List<SObject>>);
| improve this answer | |

The documentation states that the return type is List<List<SObject>>, so (D) would technically be the correct answer. (B) is definitely not the correct answer, as there is no data type called Maps.

| improve this answer | |

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.