Find your content:

Search form

You are here

Relationships in SOSL


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 
                             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

My Block Status

My Block Content