Questions tagged [sosl]

SOSL the Salesforce Object Search Language syntax. Use this tag for questions related to SOSL and handling query ouput.

Filter by
Sorted by
Tagged with
-2 votes
1 answer
31 views

How can I show the Result with the trigger that I created?

So, I'm studying Apex Triggers in Salesforce with a practical exercise. As long as I was developing the exercise, I thought at my logical code, but when I tested the components, I had a problem with ...
user avatar
0 votes
1 answer
14 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
2 answers
24 views

Can you look for record ID's using SOSL?

I'm trying to play around with SOSL and was wondering is it possible to look for record ID's using SOSL? I tried FIND {0D56F0000DPRLnKSQX} IN ALL FIELDS RETURNING FeedItem(id,body) But it comes back ...
user avatar
2 votes
1 answer
105 views

How to return List of a list in Apex Rest Get Method Using SOSL

I tried make this restapex code, and tried to using SOSL to find value this is my apex code when i used SOQL and it works well. @RestResource(urlMapping='/Account/*') global with sharing class ...
user avatar
-3 votes
1 answer
26 views

Illegal assignment from List<String> to List<Order> (4:21)",

Im having this issue which I dont understand. Any advice?
user avatar
1 vote
1 answer
54 views

Can I use SOSL to identify all records with a certain lookup value?

What happened: someone incorrectly merged two contacts. A host of related objects had lookups populated to these two contacts. When the contacts merged, all those objects were updated to all point to ...
user avatar
  • 3,652
0 votes
0 answers
13 views

Lightning Service Console: capture search result selection

I've got a CTI that loads search results in Lightning Service Console for multiple matches for one phone number, e.g. 3 contacts for the same landline. The search result is just a SOSL standard search....
user avatar
  • 1
0 votes
0 answers
56 views

What should be used to search a string across multiple fields of a single object? SOQL or SOSL

I want to search records for a particular object based on filter string that can match multiple fields on that object. This can be achieved via both SOQL and SOSL: SOQL : using like operator, applying ...
user avatar
  • 2,450
2 votes
0 answers
37 views

Bind Variables and Inconsistent Results in SOSL

I have some Apex code that does a SOSL query. If it uses bind variables, some users don't get results. If I build the query with string concatenation, then the results are consistent across users. ...
user avatar
0 votes
0 answers
55 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
-2 votes
2 answers
51 views

because you can't populate a map with lists of lists

trying to populate a map with a list list like this: map<integer , listlist<<sobject>>> mpsosl=[find ' ba' IN all Fields RETURNING contact(name)]; error:Illegal assignment from List&...
user avatar
0 votes
1 answer
65 views

Why is "you must specify a language where clause for knowledge articles in this API version" error occurring on API version 51?

I have SOSL queries in my Apex which work well on Knoledge__kav object. When running test classes I receive the "you must specify a language where clause for knowledge articles in this API ...
user avatar
0 votes
1 answer
193 views

SOSL use FIND with bind list of Strings - Specified search expression can not be converted to string

I have a list of strings (phones) which I'm trying to use inside my SOSL Find clause and its giving me issues: List<String> phonesList = new List<String>(); for(Account acc : acclist) { ...
user avatar
  • 405
4 votes
1 answer
50 views

What really happens when a SOSL SearchQuery is longer that 4000 characters?

According to the SOQL and SOSL Reference page on FIND {SearchQuery}: If the SearchQuery string is longer than 10,000 characters, no result rows are returned. If SearchQuery is longer than 4,000 ...
user avatar
  • 10.9k
0 votes
0 answers
46 views

Executing the searchContactsAndLeads method failed. Either the method does not exist, is not static, or doesnot return the expected search results [duplicate]

public class ContactAndLeadSearch { public static List<List<sObject>> searchContactsAndLeads(String searchword) { String searchQuery = 'FIND \'' + searchword + '\' IN ALL ...
user avatar
1 vote
1 answer
68 views

How can I get Record Type, Link and Name of child records from a SOSL search?

I am building a small lightening component that on input search it should return account record names alongside contact record names alongside their types if they are account of contact and a link to ...
user avatar
2 votes
0 answers
102 views

SOSL - binding a list of IDs to an IN clause

SOSL is returning different results when using a bind variable. For example, the following code snippet returns fewer results when a bind variable is used and returns more results when the bind ...
user avatar
7 votes
1 answer
1k views

SOQL query to fetch records with reserved characters ('*', '/', '(', ')')

Hoping there is a simple answer that I am overlooking. Currently, we are able to search for the following reserved characters with an escape sequence, eg a backslash character '\', in SOSL: & | ! ...
user avatar
0 votes
2 answers
460 views

Is it not possible to search by Id field with SOSL?

Why can't I do this? FIND "0Hn8A00000093AvSAI" IN ALL FIELDS RETURNING Contact(Name, Id) If I put a part of the Name of the contact with that ID, I get that contact back. But when I put the ...
user avatar
  • 191
0 votes
2 answers
69 views

SOQL Query to extract certain attachments fails

I want to export attachments of those Owners who belong to a certain Organisation. I tried: SELECT BodyLength FROM Attachment WHERE OwnerId.Organisation_Name__r = 'ExampleCompanyName', but got the ...
user avatar
  • 3
0 votes
0 answers
95 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
0 votes
1 answer
279 views

How to get custom field from ProcessInstance Object

I am trying to get Approval Status and some fields via TargetObjectId. SELECT Id, TargetObjectId, TargetObject.Name From ProcessInstance Where TargetObjectId='XYZ' The above SOQL works fine but when ...
user avatar
1 vote
1 answer
113 views

Apex SOSL-query doesn't work

Query Result why SOSL-query is empty?
user avatar
0 votes
1 answer
365 views

Query involving parent and child objects in where, group by and order by clause

I have an object called SRC which has account as lookup in it. SRC content will be as shown below: SRC ID Account__c Status City__c LastModifiedOn 1 1 Yes Delhi 12-Apr 2 1 No Cochin 13-Apr 3 2 No ...
user avatar
0 votes
1 answer
93 views

Converted SOSL from SOQL is not working

SOQL query SELECT Id, Name FROM Opportunity WHERE College__r.Phone LIKE '%7411162213' OR College__r.OtherPhone LIKE '%7411162213' on running on developer console it gives result total ...
user avatar
2 votes
1 answer
39 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
0 votes
1 answer
60 views

SOSL , in all fields and in any fields [closed]

I'm confused on when do i really need to use IN ANY FIELDS and in ALL Fields . Can someone clear things out for me thank you!
user avatar
  • 25
1 vote
2 answers
256 views

History field is blank for this query, Please help :)

I am new to salesforce, please help me out with this one: I am trying the following SOQL query to retrieve the changes made to the teacher object but I am getting nothing in the history tab. I turned ...
user avatar
0 votes
1 answer
232 views

SOSL Query returning different results in anonymous and class

We are facing a strange error when running SOSL query in our production environment. We have a component that runs SOSL queries within a custom object, looking in all text fields When we run this SOSL ...
user avatar
  • 562
0 votes
1 answer
155 views

Locating Email within Contact and Leads records using SOSL and LIMIT keyword

I have a question regarding a SOSL statement used with a Limit of 1 in trying to search for an email address in either contact or lead records but I only want to return the first occurrence using the ...
user avatar
1 vote
1 answer
177 views

What's the main differences between isQueryable() vs isSearchable()

What's the main differences between isQueryable() vs isSearchable() ? I couldn't find any reasonable information
user avatar
  • 21
0 votes
1 answer
190 views

SOSL query ApexClass not returning result with Name Fields search group

I'm trying to SOSL search ApexClass below. FIND {MyTestClass} IN NAME FIELDS RETURNING ApexClass(Name) The Name on ApexClass is a name field. Why this SOSL query has no record returned?
user avatar
0 votes
0 answers
39 views

SOQL query to get files names related to account [duplicate]

I want to get the names of all related files in the Account object. Below is my query: SELECT Name, (SELECT Id from Attachments) FROM Account WHERE Id= '0014K00000C6b7pQAB' When I run the query, it ...
user avatar
0 votes
1 answer
50 views

setFixedSearchResults not working?

I have a test method calling setFixedSearchResults with 5 ids, and then a method performing an SOSL search. I expect my search to return 5 records. In fact, it did in my previous scratch org, test ...
user avatar
1 vote
0 answers
123 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
0 answers
34 views

Mysterious SOSL results for Product2: adding term increases number of results

I am running SOSL queries on the Product2 table and I am getting results that I don't understand. Our Product2 table contains about 17,000 items, most of them tyres. A typical product name is "...
user avatar
0 votes
1 answer
77 views

SOSL Query on Product does not search the standard Family field

I am executing the following query: FIND {LANDWAGEN} IN ALL Fields RETURNING Product2(ProductCode ORDER BY ProductCode) I know there are products with this value in the Family field, but 0 rows are ...
user avatar
0 votes
1 answer
1k views

SOSL syntax to search from all objects

I need to create a custom search on Lightning Component where I should be able to search the text from all the objects through SOSL. I followed the module on trailhead and was able to create a custom ...
user avatar
0 votes
0 answers
54 views

Getting Error while querying Account list -sosl -salesforce

I am getting error while querying Account & cusst obj Customer ,Below is my error and query. Error :"Line: 9, Column: 29 Incompatible types since an instance of List<SObject> is never ...
user avatar
  • 21
0 votes
0 answers
63 views

Lookup text field is returned as object in SOSL query

this query is run on the Contact object. I need to get the name of the Account which is assigned to current contact. the query works with simple SOQL: SELECT Account.Name FROM Contact LIMIT 1 Output ...
user avatar
0 votes
2 answers
251 views

SOSL Query and Update

I am practicing SOSL queries. I tried to find the matching records of given Email ID across all objects and update it to new Email ID using SOSL query. My Code: public class Soslxmpl{ public List&...
user avatar
  • 13
3 votes
1 answer
394 views

Can we have sub query in SOSL?

I have to retrieve parent and related child records in a query . The way we do it in SOQL is SELECT Name, Description__c, (SELECT Description__c, Name FROM Child__r) FROM Parent Similarly I have ...
user avatar
1 vote
0 answers
71 views

SOQL query with 'LIKE not giving expected results

In my org, I've set up some custom metadata on which I have all text fields which I am querying. On my query without anything in the where condition SELECT Label,Fields__c,Labels__c,Scheme__c from ...
user avatar
  • 155
3 votes
0 answers
55 views

How to make existing custom setting searchable?

I have one custom setting in our org which is not searchable, as verified by confirming that searchable = FALSE when viewing the object info via Workbench. Dozens of other custom settings in our org ...
user avatar
2 votes
0 answers
31 views

SOSL Wildcart Search Returning Multiple Objects Excludes Results

I am running a SOSL with a query similar to the one below: FIND {joh* OR smith*} IN ALL FIELDS RETURNING Account(Firstname,Lastname WHERE Firstname LIKE 'joh%' AND Lastname LIKE 'smith%'), Contact(...
user avatar
0 votes
1 answer
88 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 votes
1 answer
146 views

Why the SOSL doesn't get what it needs?

SOSL String searchword ='Red'; String searchStr1 = '*'+searchword+'*'; String searchQuery = 'FIND \'' + searchStr1 + '\' IN ALL FIELDS RETURNING Product2(Id,Name)'; List<List<sObject>> ...
user avatar
  • 57
1 vote
1 answer
2k views

SOSL query searching in multiple fields

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 ...
user avatar
1 vote
1 answer
385 views

Does Global Search in lightning truly not have the ability to actually search all records?

I know this is old news, but I wanted to make sure I understood the limitations of Global Search before I go ranting on the IdeaXchange, because it still boggles my mind that you cannot actually ...
user avatar
  • 3,652
0 votes
1 answer
293 views

Filter Object Queries Based On Profile Name

So, as the title says, I would like to find all the records of an object that have been created by OR are only visible by a certain profile. Here is a query I have tried SELECT Id, Subject, ...
user avatar
  • 13

1
2 3 4 5
7