Can I use relationships in SOSL?
Example: Find all first names that start with 'Roc' within Position__c
FIND \'Roc*\' IN ALL FIELDS RETURNING Position__c(Id, Contact__r.FirstName WHERE Title__c = 'Paper Jammer')
Attribution to: fourq
Possible Suggestion/Solution #1
SOSL does not support traversing relationship query .
When you write a query as below
List<List<SObject>> searchList = [FIND :mySearchText IN ALL FIELDS
RETURNING
Account (id, name,phone, BillingStreet,BillingCity,BillingState, owner.Alias,owner.MobilePhone )];
You will notice that owner.Alias will be null but you will still get ownerId and you can use ownerId to further form queries .
Attribution to: Mohith Shrivastava
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/5179