You need to sign in to do that
Don't have an account?
Priyanka Bardhan
SOSL OR condition - searching set of ids
Hi,
Can anyone please help with OR condition in SOSL?
I am trying to find ids in Custom Object records. Below snippet I am trying in workbench. I tried with double quote also, but it didn't work. Please note ids contains hypen.
List<List<sObject>> instanceRecs = [FIND {'7675675670-6795-4621-817e-74a6b056556' OR '56524ab-eaaf-4eb2-bccf-85bfd565650'} IN ALL Fields Returning Instance__c];
Also, whether it is possible to search set of ids in SOSL?
Thanks,
Priyanka
Can anyone please help with OR condition in SOSL?
I am trying to find ids in Custom Object records. Below snippet I am trying in workbench. I tried with double quote also, but it didn't work. Please note ids contains hypen.
List<List<sObject>> instanceRecs = [FIND {'7675675670-6795-4621-817e-74a6b056556' OR '56524ab-eaaf-4eb2-bccf-85bfd565650'} IN ALL Fields Returning Instance__c];
Also, whether it is possible to search set of ids in SOSL?
Thanks,
Priyanka
1) https://trailhead.salesforce.com/en/modules/apex_database/units/apex_database_sosl
This example shows how to run a SOSL query in Apex. This SOSL query combines two search terms by using the OR logical operator—it searches for Wingo or SFDC in any field. This example returns all the sample accounts because they each have a field containing one of the words. The SOSL search results are returned in a list of lists. Each list contains an array of the returned records. In this case, the list has two elements. At index 0, the list contains the array of accounts. At index 1, the list contains the array of contacts.
Execute this snippet in the Execute Anonymous window of the Developer Console. Next, inspect the debug log to verify that all records are returned.
In your case try below code
List<List<sObject>> instanceRecs = [FIND '7675675670-6795-4621-817e-74a6b05655' OR 56524ab-eaaf-4eb2-bccf-85bfd565650' IN ALL Fields Returning Instance__c];
Let us know if this will work