this query is run on the Contact object. I need to get the name of the Account which is assigned to current contact.

the query works with simple SOQL:

SELECT Account.Name FROM Contact LIMIT 1

Output for Account.Name:

'Mike Smith'

But I am trying to get the same output with SOSL:

FIND {PR} IN ALL FIELDS RETURNING Contact (Account.Name WHERE AccountId IN ('33W43848374837')) Limit 50

Output for Account.Name:

[object Object]

Is there any way how to get this value as String using SOSL?

  • Return type of SOQL is List<List<SObject>>. So you need to extract that. – rahul gawale Jul 6 at 16:27
  • 4
    This is likely just an artifact of the dev console (which I suspect you're using). The developer console has some limitations in displaying related data. If you do this query via anonymous apex and extract the SObject appropriately, then the data will show up just fine in a system.debug(). – Derek F Jul 6 at 16:34

Your Answer

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

Browse other questions tagged or ask your own question.