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 LIMIT and regardless of the order of the SFDC objects used within the RETURNING statement. IN the following the query, the lead record email will not be found by the SOSL query:
FIND {"[email protected]"}
IN EMAIL FIELDS
RETURNING *Contact*(Id),Lead(Id) LIMIT 1
- The lead Id will not be returned unless I swap the contact object with the lead object in the RETURNING statement such that the Lead(Id) is first using LIMIT 1 like this:
FIND {"[email protected]"} IN EMAIL FIELDS RETURNING Lead(Id),Contact(Id) LIMIT 1
- Or, it will work using the following SOSL but I risk having multiple results:
FIND {"[email protected]"} IN EMAIL FIELDS RETURNING Contact(Id),Lead(Id)
Question: Is there a way I can run this SOSL statement using a LIMIT 1 without having to worry about the order of the 2 Salesforce objects in the RETURNING statement?
Thanks