+ Start a Discussion
someonesomeone 

SOSL with join

I have an SOSL FIND query to find contacts by phone number:
FIND {*' + phone + '} IN PHONE FIELDS RETURNING Contact(LastName, FirstName, AccountId)';
I'd also like to return the accounts for each contact (if one exists) joining on Contact.AccountId. Is it possible to do in one statement? If not, how would I loop through the results to get the account, and return all in json format?
Shri RajShri Raj
In Apex, the value of the FIND clause is demarcated with single quotes. For example:
FIND 'map*' IN ALL FIELDS RETURNING Account (id, name), Contact, Opportunity, Lead
In the Force.com API, the value of the FIND clause is demarcated with braces. For example:
FIND {map*} IN ALL FIELDS RETURNING Account (id, name), Contact, Opportunity, Lead