Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

SOSL query searching in multiple fields

Asked by Ankit Chauhan Jul 1, 2021 2.4K views 2 answers
Share

About this question

I want to search in multiple fields using SOSL. I know that it allows to search in all fields using below syntax-

FIND {"Smith"} IN ALL FIELDS RETURNING contact (name), lead (name)
And also works perfectly fine with single field if I supply any field's name instead of ALL like below-
FIND {"Smith"} IN Name FIELDS RETURNING contact (name), lead (name)

What I want to try is something like below-

FIND {"Smith"} IN (NAME, COMPANY) FIELDS RETURNING contact (name), lead (name)

I have tried various things here for IN (NAME, COMPANY) like below-

    • IN NAME, COMPANY
      IN {NAME, COMPANY}
      IN NAME; COMPANY

Can someone please suggest if there is a way of doing it in SOSL.

Your answer

2 Answers

Carmelita Sandberg Latest answer

Answered on Apr 20, 2025

Hello, since you can't combine the results in a single SOSL query, you would need to execute both queries separately in your code and then combine the results programmatically. Check out brawl stars online to know more information.

Was this helpful?

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.