Questions tagged [dynamic-sosl]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
25 views

How to use WHERE clause in SOSL query

I am trying to use the existing LWC with some modifications to get records on the basis of RecordType.Id but it's throwing an error instead. System.QueryException: expecting a right parentheses, found ...
user avatar
0 votes
0 answers
66 views

Need help in putting not equal to field in SOSL in Salesforce

I have created the below SOSL for my Apex class as per the req to return the queried valued from the data base , but i am not able to put the not equal to operator in below SOSL, i have tried the ...
user avatar
0 votes
2 answers
807 views

Script-thrown exception in salesforce Apex

Hi I am trying to make a dynamic SOSL on the basis of certain condition, but getting the error as script thrown exception. below is my code : List<List<ABC__c>> list1 = new List<List<...
user avatar
0 votes
0 answers
106 views

SOSL does not find gmail domain in emails for Site Guest User

When running a SOSL query as the Site Guest User in an Experience Site, I am unable to retrieve any results if I return more than one object at a time while the search query is 'gmail.com' As an ...
user avatar
2 votes
1 answer
42 views

Why does SOQL show there is data but SOSL returns no results?

I want to search for a list of phrases. I used SOSL to search for a string to begin with but it is returning zero results yet when I run a soql I can see there is data. Any ideas? Thanks. FIND {Animal}...
user avatar
  • 197
1 vote
0 answers
143 views

Dynamic SOSL with multiple search terms not returning records with email or phone number

I am facing couple of challenges with Dynamic SOSL. Records are available with "test.abc1@test.digital or test.abc@test.com" and "(123) 456-7890"(based on locale). we are using ...
user avatar
0 votes
1 answer
105 views

SOSL Query: Getting different number of records while searching with 1234* and abcd1234*

I have a community page. It has a search box and a list view to display the search result. Below is the Query I'm building: (It will search in 15M total records) List<List<sObject>> ...
user avatar
1 vote
1 answer
388 views

SOSL query getting malformed query exception

I have built up a dynamic search query using sosl The query string given below FIND {a016g00000D57xKAAR} IN ALL FIELDS RETURNING Attachment(ParentId), ContentVersion(FirstPublishLocationId), ...
user avatar
  • 1,093
1 vote
1 answer
441 views

Not able to search fields using SOSL for Case module

I am trying to fire a SOSL query in Apex to find phone number exits in Case module. Below is the example of one of the cases that I am trying to search. I am using following query to search the ...
user avatar
  • 197
2 votes
1 answer
288 views

Variable in SOSL Query

In SOSL can I add a variable to the fields? As: FIND {Clinica} IN Name Fields RETURNING Account(VARIABLE HERE) Thanks
user avatar
0 votes
1 answer
97 views

SOSL return failing manage package

SOSL running fine on lower instances with no namespace getting failed in manage package.Although the SOSL EXECUTE returns rows but final output always remains 0. Working fine on unmanage. searchQuery ...
user avatar
  • 212
3 votes
1 answer
223 views

SOSL query on Lightning Knowledge Articles returns only 250 records even if there are more than 2000+ matching records

Below query returns 250 records FIND {*test*} IN ALL FIELDS RETURNING Knowledge__kav(Id, Title WHERE PublishStatus='online' AND Language= 'en_US') Below query returns 2000 records FIND {*test*} IN ...
user avatar
3 votes
1 answer
1k views

SOSL not returning all expected results

I'm trying to SOSL search a custom object we have, by a phone number field but the results are not working as I'd expect. The issue seems to be around missing characters at the start of the search ...
user avatar
2 votes
1 answer
3k views

System Permissions Assigned to Permission Set

Is there a SOQL/SOSL to export/FETCH only the System Permissions from a Specific Permission Set in Salesforce.
user avatar
0 votes
1 answer
377 views

How to use dynamic filters in SOSL queries

I have this below 2 SOSL queries. One which is simple one and 2nd is dynamic. I am passing the below data to this method. The 1st SOSL is returning the data, but the dyanamic SOSL is returning NULL. ...
user avatar
6 votes
1 answer
646 views

Is there a reliable way to know which SObjects are supported by a SOSL search?

Having some trouble as an ISV with dynamic SOSL. I have a search box that searches all records. When building the SOSL query, I only add objects that have the IsSearchable flag set to true on the ...
user avatar
0 votes
1 answer
141 views

SOSL No Result in Apex (Not Test Mode)

I want to query matching Accounts based NRIC Passport No AND Service Agent looking up to custom object Agent__c with a set of Ids (for bulkification) and i'm using: FIND '999999' IN ALL FIELDS ...
user avatar
1 vote
1 answer
2k views

SOSL Multiple Search Words

Trying to search multiple terms in SOSL in APEX. I tried this singular, of course works: [FIND 'searchOne' IN ALL FIELDS RETURNING ACCOUNT] But these don't work: [FIND 'searchOne' OR 'searchTwo' ......
user avatar
1 vote
2 answers
3k views

SOSL query with special characters

I am building a dynamic SOSL Query searchText = 'AB-C'; searchquery = 'FIND {'+ searchText + '} IN all FIELDS RETURNING Account( id, name, ownerid,website, CMFL__Oppty_Count__c WHERE '+ condition ...
user avatar
  • 11.9k
4 votes
1 answer
600 views

Does SOSL wildcard (*) work with space characters

I am currently trying to implement a sosl search query, so I can filter out non-letter characters for searching inside the salesforce database. Everything works as expected, however when I encounter a ...
user avatar
  • 63
0 votes
1 answer
75 views

"Invalid USING clause" error when using list view in SOSL

I am trying to implement SOSL list view search and this is sort of follow up question. I am trying this query in from Apex and getting error in title: System.debug( Search.find('FIND \'foo\' ...
user avatar
  • 4,479
0 votes
1 answer
463 views

SOSL Query Returning Only Empty Lists / No Results

I'm trying to use SOSL to locate Account, Contact, Lead, and Site__c records by Id using a dynamic string of matching ids obtained from Destination__c records. However, I'm not returning any records ...
user avatar
  • 836
2 votes
1 answer
124 views

SOSL having discrepant results than SOQL for same operation

We are performing SOQL and SOSL operation to find particular value on an object. Please find below code: String searchCustomerMobileNo = '9999999999'; Double mobileNo = Double.valueOf(...
user avatar
0 votes
1 answer
1k views

How to implement Dynamic SOSL with 'Contains' keyword

This is an embedded VF page on the Contact detail page. I have this SOSL query to display all the related contact records on every Contact detail page. But for few contacts, email field(of Parent ...
user avatar
1 vote
2 answers
883 views

SOSL search in master details objects

I have two object A__c(s1__c) and B__c(s2__c) and relationship among them is Master-details. I have to make a SOSL search in field of both(s1__c and s2__c). Find {searchText} Returning A__c(s1__c), ...
user avatar
  • 11
2 votes
2 answers
221 views

SOSL Query returns an Error

I am trying to display related contacts on the record detail page based on the current Contact record id. For the related contacts, my SOSL as follows: String searchQuery = 'FIND \'' + firstName + ' ...
user avatar
-3 votes
1 answer
340 views

SOSL not able to fetch records when called from Apex, even though database having matching records

I have been facing a unique kind of issue since the last 2 days, I am using SOSL Query in my Apex. It is working on a partial basis, i.e, returning records perfectly in some cases, while not returning ...
user avatar
0 votes
1 answer
375 views

expecting a right parentheses SOSL

I am creating a dynamic SOSL which finally executed as below when I print in debug: FIND 'gar,ont2' RETURNING Contact ( Name, FirstName, LastName WHERE (Preferred_First_Name__c like '%gar%' OR ...
user avatar
  • 1,549
0 votes
1 answer
435 views

Dynamic sosl query not returning all events with search term in their subject

I seem to have an odd issue where for certain text phrases being searched with sosl, not all events being queried with the sosl search are returned that should be. For example: when FIND (meeting*) ...
user avatar
  • 2,359
2 votes
0 answers
155 views

SOSL query on ContentDocument [closed]

I have a requirement to search within files. To get that working, I have a SOSL query on ContentVersion. It seemed to work as expected when I tested as myself, however... I myself seem to get the ...
user avatar
  • 2,743
0 votes
1 answer
617 views

Dynamic SOSL SearchQuery with AND Clause for Contact Firstname and Lastname

If i am trying to make a SOSL Search Query dynamic where Firstname and Lastname will be coming from remote parameter dynamically. Attached code sample is not working - But if i make the SOSL Query ...
user avatar
0 votes
1 answer
156 views

Performance issue for searchable 500+ fields

I haven't work on something like this before but what are the performance implication whether using SOQL or SOSL 500 fields+ (fields will be added dynamically as the application grows) and having 800K ...
user avatar
  • 6,612
0 votes
1 answer
1k views

How to get all email type field values

How to get all email type field values in a salesforce lead record from a record id in apex class.
user avatar
0 votes
1 answer
1k views

From Parent ID, dynamically derive child's lookup field name/token

I'm trying to save a new record dynamically, but I'm having a problem with a lookup field. For instance, I'm able to get the parent object with the id. Id relatedID = '<someId>'; SObjectType ...
user avatar
  • 765
14 votes
4 answers
33k views

Only variable references are allowed in dynamic SOQL/SOSL

I'm trying to re-request an Asset from the database: asset = Database.query('SELECT ID, Price, Asset_MRR__c FROM Asset WHERE id =: ' + asset.id + ' limit 1'); But I get an error: Only variable ...
user avatar
  • 551
8 votes
1 answer
1k views

Can we have a ORDER BY Clause in SOSL

I am running a SOSL Query and i want the results to be order by a particular field. System.QueryException: unexpected token: ORDER Here is the query i am building in my apex FIND 'Cisco Systems*' ...
user avatar
  • 11.9k
2 votes
3 answers
313 views

SOSL: System.QueryException: Non-selective query against large object type (more than 100000 rows)

We have over 100,000 contacts to query the system to get this error. SOSL: System.QueryException: Non-selective query against large object type (more than 100000 rows) However, this error is only ...
user avatar
2 votes
1 answer
195 views

Showing matching keyword sentences from SOSL/SOQL results

We have a requirement to search in large text area field (for e.g. Description). We are using SOSL for the same. While showing results on the VF page we want to only few sentence from Description ...
user avatar
  • 2,232
3 votes
2 answers
6k views

How do I create a Dynamic SOSL Query

I need to allow a User to narrow their article search by ArticleType when desired My current Controller handles the search input just fine and can also accept a search via a URL parameter. Where I ...
user avatar
  • 802
7 votes
2 answers
2k views

SOSL query returns only 250 records even if there are more than 2000+ records present

I have two queries List<sobject> soslRecords1 = Search.query('FIND {I need help res*} in all fields returning Incident__c (id) where ID IN:rec_ids')[0]; List<sobject> ...
user avatar
  • 71
3 votes
1 answer
1k views

Interpreting wildcards (eg, * and &) in SOSL queries through the API. Escape or not?

I have a search feature that is implemented with the AJAX toolkit to use SOSL. var results = sforce.connection.search("FIND {" + sanitize(...) + "} IN NAME FIELDS RETURNING ..."); The sanitize(...) ...
user avatar
  • 2,564
4 votes
5 answers
3k views

Function to properly escape dynamic SOSL input

I have a page that allows users to specify a search term that then gets put into a SOSL Query. Obviously I'm escaping single quotes to prevent injection, but certain input still cause my code to ...
user avatar
  • 9,537
5 votes
1 answer
2k views

Escaping reserverved characters in SOSL queries

Escaping reserverved characters with backslash as described in Force documentation (http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_sosl_find.htm) give unexpected ...
user avatar
  • 181
8 votes
4 answers
9k views

How do I SOSL across objects, matching all records with FIND clause?

To all the expert SOSL gurus lurking out there, I thought this will be an interesting one: I have some SObjects of different types and I want to return their Name values in a single query. In ...
user avatar