You need to sign in to do that
Don't have an account?
thomast
Substring searches not possible with SOSL, right?
The last bullet of the SOSL challenge says, "The 'searchContactsAndLeads' method must accept an incoming string as a parameter, find any contact or lead that matches the string as part of either the first or last name and then return those records."
But the text above says that SOSL searches based on word boundaries, and I couldn't figure out a way to do sub-string searches, ie, one where a search for "mit" would return results for "Smith". I passed the challenge with just a basic SOSL query, but I don't think that it meets that last criterion, strictly speaking.
But the text above says that SOSL searches based on word boundaries, and I couldn't figure out a way to do sub-string searches, ie, one where a search for "mit" would return results for "Smith". I passed the challenge with just a basic SOSL query, but I don't think that it meets that last criterion, strictly speaking.
will find all fields in Contact and Lead that contain "mit"
To do this dynamically you would just do
For more info
http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_sosl_find.htm
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_sosl.htm
The docs at the first link say "Asterisks match zero or more characters at the middle or end (not the beginning) of your search term." (emphasis added).
And when I run
in the Dev Console Query Editor, I get no results, when {Smit*} or {Smith} returns the expected rows.