Region__c is the self lookup on Agent__c. One region have many agents. When searchString = region name, it displays only one record.

I want to display all Agents in that region. How to achieve this?

String searchquery = 'FIND \'*' + searchString + '*\' IN ALL FIELDS RETURNING Agent__c (Region__c,Region__r.name, Manager__c, Manager__r.name,Name), user( id, Name) limit 1999'; 

I create Agent custom object and self lookup field name Region. Below query is working fine for me and giving expected results -

FIND {test} IN ALL FIELDS RETURNING Agent__c (Region__c,Region__r.name, Name)

Here test is the name of record.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.