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
3
votes
2answers
356 views

Number of currently logged users to the community

I trying display number of currently logged users to the community in my lightning component. Now I using below SOQL query: List<AggregateResult> numberCurrentlyLogged = [SELECT ...
3
votes
1answer
250 views

SOSL FIND of Joe return John

I wrote a SOSL query: FIND {Joe} IN NAME FIELDS RETURNING Contact It returned me couple of records in which one of them had Mark John in the name field of the Contact. Reading the SOSL documentation ...
0
votes
2answers
180 views

Record search with and without apostrophe

We want to get account record in Salesforce with soql or sos. e.g suppose St. Patrick's account exists. Whenever we enter St. Patricks in input text box then system needs to return above record i.e ...
2
votes
1answer
560 views

Bulkify SOSL query in loop

I'm trying to build a process which looks up a matching account for a lead, given a cleaned email or website. The issue I'm facing is that this could be run against 1000 or 10k leads at once and the ...
1
vote
2answers
806 views

How to search Knowledge Articles bypassing Guest user permissions in Napili Community?

Background: We have a public page on Napili community where guest user can type the search term into the custom search component and see the results. If we use the OOB Napili search functionality, ...
1
vote
1answer
128 views

Picklist in SOSL on an encrypted org

Can anyone tell me if a picklist field is encrypted and I use SOSL, is there a limitation that it still wont match it in a query? Im on an ecrypted org and I am doing a query: FIND {golf*} IN ALL ...
1
vote
0answers
81 views

Need help in writing SOSL query [closed]

I have three objects: ccrz__E_Order__c ccrz__E_OrderItem__c CC_Account_Address Relation between these are as below. I have this ccrz__Order__c(Master detail with ccrz__E_Order__c ) on ...
1
vote
1answer
95 views

Comparing duplicate emails between Accounts and Leads

I realize accounts and leads are not inherently related, but due to our business process we typically see a large volume of leads that have already been converted into Person Accounts being ...
1
vote
3answers
220 views

What is difference between status and body column of ApexClass?

Query 1 : SELECT id,name FROM apexclass where (status like 'active') this query is returning valid result. Query 2 : SELECT id,name FROM apexclass where (body like 'istest') is returning below error....
3
votes
1answer
131 views

SOSL syntax - Is first list element a single record?

List <Lead> results ; String searchText; public PageReference doSearch (){ results = (List<lead>) [Find :searchText RETURNING Lead (Name, email)] [0]; In the line of results, when I set ...
1
vote
0answers
158 views

Return category group with salesforce knowledge articles

I' writing one sosl query, where I'm facing problem while returning category group. FIND {tourism} RETURNING KnowledgeArticleVersion (Id, Title WHERE PublishStatus='draft') WITH DATA CATEGORY ...
0
votes
1answer
612 views

KnowledgeableUser does not support search

Using SOSL I did the following Query: FIND {name} in NAME FIELDS Returning KnowledgeableUser(ID) Console returns the following: entity type KnowledgeableUser does not support search It looks ...
2
votes
0answers
138 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 ...
0
votes
0answers
218 views

Possible to obtain Contacts and Leads with their child relationships in one query/search?

I would like to obtain all contacts and leads that match an email address but also include their related child objects (e.g. activity histories) all in one query or one search. I can't figure out a ...
2
votes
1answer
213 views

SOSL Offset Changes Order for Knowledge

I am Running into something that appears to be a bug in how Salesforce SOSL queries work with knowledge. Consider this Snippet of code: String searchquery = 'FIND \'SEARCH TERM\' IN ALL FIELDS ...
1
vote
0answers
115 views

How to select the first record from multiple records from SOSL query

I am using SOSL query: List<List<Account>> acclist = [FIND :newstring IN ALL FIELDS RETURNING Account(id,Name,FirstName,LastName,Territory_vod__c,NPI_vod__c where RecordType.Name='...
1
vote
2answers
383 views

Getting Exception in SOSL:Non-selective query against large object type (more than 200000 rows)

I am using SOSL query in a method in Apex class.This method is getting called from trigger,when a custom object DCR is created. SOSL Query: List<List<Account>> acclist = [FIND :newstring ...
3
votes
1answer
399 views

Use Set in SOSL queries

Currently I am using SOQL query in apex class: for(Account acc: [Select FirstName,LastName,Territory_vod__c,NPI_vod__c from Account where Name In:accountSet ]){ accountSet is set having list of ...
2
votes
1answer
227 views

Difference between WITH and WHERE Filter conditions in QUERY?

Could you please someone let me know more about WITH and when its used as I came to know about it recently. I know WHERE and when and how its used. But when exactly WITH is used when compared to WHERE....
1
vote
2answers
2k views

can we query SOSL using REST API?

can we query SOSL using REST API? As we can do with SOQL like this : /services/data/v37.0/query/?q=
4
votes
1answer
635 views

Why are no results returned when performing a SOSL query on ContentNote in a Test Method?

Following the example laid out in Adding SOSL Queries to Unit Tests, I created a test method that inserts a ContentNote record, sets the results using Test.setFixedSearchResults(), and then performs a ...
4
votes
1answer
7k views

Using SOSL with where clause

Will there be any performance impact when using SOSL with where clause? There are millions of records in one of the custom object. We need to develop custom search functionality where user can select ...
1
vote
1answer
119 views

Child relationship expressions __r in SOSL [duplicate]

Is that possible to have a child relationship expressions __r in SOSL List<List<SObject>> searchList = [FIND :searchText+'*' IN All Fields RETURNING Account (id,name,industry), ...
5
votes
1answer
555 views

What is the default sort order for records in SOSL

When you search with SOSL but do not specify an ORDER BY clause, does it sort by any particular field? Example: FIND {test@example.com} IN EMAIL FIELDS RETURNING Contact(Id, Name), Lead(Id, Name) ...
1
vote
1answer
255 views

combine two SearchGroups in SOSL search

Can I combine two SearchGroup in one SOSL query? I want to search both in Name Fields and in Phone fields. Something like FIND {78*} IN (NAME , PHONE) FIELDS RETURNING Contact(id,name,phone)
0
votes
1answer
414 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 ...
0
votes
1answer
312 views

SOSL does not find numeric fields

We have the following SOSL query to find financial transactions: List> searchList = [FIND :searchTerm IN ALL FIELDS RETURNING Financial_Transactions__c (Financial_Account__r.Nickname__c, ...
0
votes
1answer
348 views

SOSL FIND query not giving correct results

I am writing a text search query with SOSL to match exact phrase. But it's giving results like in a wildcard search. FIND {CCMS} IN NAME FIELDS RETURNING Account(Id, Name) Results : 001xxxxxxxxxx ...
0
votes
1answer
95 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 ...
1
vote
3answers
431 views

Fetch Min Max Value from Multiple Objects

I have 5 different objects Obj1__c, Obj2__c, Obj3__c, Obj4__c, Obj5__c Each Object has Date Field Start_Date__c, End_Date__c Now I need to find out Min Start_Date__c And Max End_Date__c . By ...
5
votes
1answer
899 views

SOQL query FeedItem by community

I would like to query feed items on a specific community, but can't figure out how to do so in SOQL. For example, this query returns no results. SELECT Id,Body,NetworkScope FROM FeedItem WHERE ...
0
votes
1answer
151 views

How to use sosl query to get records based on string

FIND {ti} IN NAME FIELDS RETURNING Account LIMIT 10 above is my sosl query to get Account Names based on ti but the problem is,it also get the field values of website whose value contains ti.is there ...
3
votes
1answer
458 views

Trailhead: Invalid conversion from runtime type List to List: No type casting required

I'm a newbie to APEX but not the platform. Yes I'm going through the trailhead Apex Basics & Database and on the SOSL module I think I have this correct but I'm getting this List to List error: ...
0
votes
2answers
420 views

Convert SOQL Query to SOSL

I have a Query query = 'Select Id, Name, Email, Phone from Contact where (Id = ' + cstIdsList + ') ;' + 'Select Id, Name, Primary_Email__c, Phone from Account where (Id = ' + astIdsList + ') ...
1
vote
1answer
3k views

Query a Encrypted field in SOSL

I tried querying a Encrypted field in SOQL. Gives an error: encrypted field 'Email' cannot be filtered in a query call Can i achieve it using SOSL??
0
votes
1answer
1k views

To search Rich Text Area field [closed]

Custom field Cont__c, data type is Rich Text Area, but in the custom Visualforce Searchpage can't to search and error information: System.QueryException: field 'Cont__c' can not be filtered in ...
1
vote
1answer
470 views

SOSL query to return the count of all standard and custom objects from an org

Is there a simple SOSL query that one can use to determine the number of objects in an org? A bonus would be to determine what type of object it is (custom, standard, packaged) etc.
2
votes
1answer
344 views

Can the OR operator be used in SOSL queries?

Trying to do a SOSL query to find object matches for one of two variables. The following query is very simplified for easy reading. Any help is appreciated. String queryString = 'FIND :var1 OR :var2 ...
1
vote
1answer
188 views

Empty Result for SOSL Query List

New dev here and I am trying to make a SOSL query to pull accounts that contain a string variable. Not returning any results. Any guidance is appreciated Here's the vfp <apex:page controller="...
8
votes
1answer
1k views

Does SOSL allow the `-` dash character?

According to the documentation you need to escape the following special characters in SOSL search text. Escaping special characters & | ! ( ) { } [ ] ^ “ ~ * ? : \ ' The - dash character is ...
2
votes
1answer
89 views

SOSL working in dev org not working in sandbox [duplicate]

I am attempting to search for records that contain some text and limit the search results to a group of Ids. For simplicity, I'll remove the "search for text" part in this question. The problematic ...
1
vote
1answer
969 views

How do I change my SOQL below so that Shield Platform Encryption is supported on SSN and the query supports large amounts of data

Our company has several packages and we've recently been asked to do some analysis on how to make them compatible with Salesforce Shield field encryption. In the Shield encryption considerations doc, ...
0
votes
1answer
619 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.
4
votes
1answer
168 views

SOSL Search Results incomplete?

I have the following SOSL: FIND {*ball*} IN ALL FIELDS RETURNING Campaign(Name, Subscription_Center_Description__c) I have the following 3 campaigns that SHOULD show up: Name: Sportsball, ...
4
votes
0answers
406 views

SOSL - Combining results from multiple objects into a single result set [closed]

If you query from multiple objects the SOSL query returns a List<List<SObject>>, with each inner List sorted by relevance inside. I want to return a combined mixed list sorted by relevance ...
3
votes
3answers
22k views

How to query child to parent

How to query child to parent like contact to parent..and how to query master lookup relations. select id,lastnam,(select id,name from account where accountid=conatctid)from contact
2
votes
2answers
1k views

I wanna run my SOSL to search for a string obtained by function parameter

I wanna search for a particular string obtained by my function parameter in Contact & Lead FirstName & LastName fields.. The difficulty is how to compose a SOQL statement for that,as I am ...
0
votes
2answers
61 views

How would I search for objects that begin with X

I'd like to be able to search for all leads, accounts, opportunities, etc. that begin with a character. I tried just typing one character and searching, but this resulted in "your search term must ...
2
votes
2answers
1k views

Method does not exist, is not static, or does not return the expected search results

Hi I'm doing the challenge for SOSL Queries and here is what I have accomplished so far. public class ContactAndLeadSearch { public static List < List < SObject >> searchList(String ...
10
votes
4answers
17k 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 ...