function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Bhanu joshi 10Bhanu joshi 10 

SOSL with searchstring

"FIND {"Joe Smith" OR "Joe Smythe"}
IN Name Fields
RETURNING lead(name, phone), contact(name, phone)" 
when i am running this query from developer console on "ExecuteAnonymousWindow" .
I got the following error: 
"Unexpected token '<'."
any help on this?
thanks in advance
Best Answer chosen by Bhanu joshi 10
Amit Chaudhary 8Amit Chaudhary 8
Try to execute your code like below
List<List<SObject>> searchList = [FIND 'Joe Smith OR Joe Smythe'  IN Name Fields RETURNING lead(name, phone), contact(name, phone) ];
For more information please check below post
1) https://trailhead.salesforce.com/en/modules/apex_database/units/apex_database_sosl

Let us know if this will help you

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Try to execute your code like below
List<List<SObject>> searchList = [FIND 'Joe Smith OR Joe Smythe'  IN Name Fields RETURNING lead(name, phone), contact(name, phone) ];
For more information please check below post
1) https://trailhead.salesforce.com/en/modules/apex_database/units/apex_database_sosl

Let us know if this will help you
This was selected as the best answer
Bhanu joshi 10Bhanu joshi 10
Thanks Amit