function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
John SmithJohn Smith 

Help Regarding SOSL

Can we search on Multiple fields in SOSL, for example:


FIND {MyProspect} IN NAME OR PHONE
 
Navatar_DbSupNavatar_DbSup

Hi,

 

Yes you can do search on multiple fields, for example, you can return a list of accounts, contacts, opportunities, and leads that begin with the phrase map:

 

List<List<SObject>> searchList = [FIND 'map*' IN ALL FIELDS RETURNING Account (id, name), Contact, Opportunity, Lead];

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

John SmithJohn Smith

I dont want to search all fields, want to search just: name and Phone fields. Can we accomplish that?