Salesforce SOSL with CONTAINS

0 votes

I noticed apps on Salesforce that could perform run CONTAINS queries. The CONTAINS filtering is possible even with the basic list filter functionality on object lists.

I tried the following with SOSL:

List<List<SObject>> searchList = [FIND '*ben* AND *berlin*' IN ALL FIELDS 
                                  RETURNING Account(Name)];

I have an account name "BigBen" in "Berlin". I am not able to find this account using upper SOSL call. I tried different combinations, but no success. How do i do SOSL calls with CONTAINS? Using the basic list filtering i am able to use CONTAINS with "ben", it gives me the expected results.

Mar 28 in SalesForce by surbhi
• 3,810 points
25 views

1 answer to this question.

0 votes
Unlike SOQL, which uses the LIKE comparison operator to support wildcards anywhere in the search word, SOSL does not allow wildcards at the start of a search term (a "starts with" search).

In this scenario, where you're only looking for one sObject, SOQL might be a better option.
answered Mar 29 by CoolCoder
• 4,360 points

Related Questions In SalesForce

0 votes
0 answers

Salesforce Apex SingleEmailMessage with Template to User not contact

Im trying to send an email in ...READ MORE

Feb 28 in SalesForce by surbhi
• 3,810 points
220 views
0 votes
1 answer

Salesforce Apex/JSON serialization with change on variable name

Apex does not support annotation for serialization. But, ...READ MORE

answered Mar 2 in SalesForce by surbhi
• 3,810 points
151 views
0 votes
1 answer

Username/password JWT with Salesforce Named Credentials

Although Named Credentials cannot be used to ...READ MORE

answered Mar 2 in SalesForce by surbhi
• 3,810 points
121 views
0 votes
0 answers

Can i create a sql table populated with Salesforce objects?

does Salesforce offer a way to obtain ...READ MORE

Mar 4 in SalesForce by surbhi
• 3,810 points
43 views
+2 votes
2 answers

Salesforce Interview questions

Here are some questions very important for ...READ MORE

answered Jan 11, 2019 in Career Counselling by Suresh
• 720 points
1,835 views
0 votes
1 answer

How to connect to salesforce from tableau?

Hi, follow these steps to connect to Salesforce: 1. ...READ MORE

answered Mar 25, 2019 in Tableau by Cherukuri
• 33,010 points
289 views
0 votes
1 answer

Power BI - Salesforce

Hi, Follow below steps: 1. Go to Data source. 2. ...READ MORE

answered Mar 25, 2019 in Power BI by Cherukuri
• 33,010 points
174 views
0 votes
1 answer

What is the best training for Salesforce ADM-201 Exam?

Hi @Vardhan, I took Edureka's Salesforce Training that covers all ...READ MORE

answered Jun 3, 2021 in Others by Jaya
• 140 points

edited Dec 22, 2021 by Soumya 204 views
0 votes
1 answer

Salesforce Apex SingleEmailMessage with Template to User not contact

// Pick a dummy Contact Contact c ...READ MORE

answered Mar 17 in SalesForce by CoolCoder
• 4,360 points
66 views
0 votes
1 answer

salesforce how to login with javascript without security token

OAuth2 is a security protocol that allows ...READ MORE

answered Apr 1 in SalesForce by CoolCoder
• 4,360 points
35 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP