You need to sign in to do that
Don't have an account?
Desai
SOQL query in developer console
Simple Child to parent query in developer console returns as [object object] .
SOQL query :
SELECT Account.Owner.Name FROM Contact
any suggestions please.
Regards,
Desai
SOQL query :
SELECT Account.Owner.Name FROM Contact
any suggestions please.
Regards,
Desai
you can use workbench to see the right result.
go through this link for work around https://developer.salesforce.com/forums/?id=9060G000000BfMjQAK
Thanks
Anil.B
Yes, you are right that this query 'SELECT Account.Owner.Name FROM Contact' returns data in the form of [object object] when we execute in Query editor, but if we run this query in the Execute Anonymous window it returns a list.
I believe this is currently a limitation or bug of the dev console. Trying to flatten a javascript object to a string returns the literal "[object Object]" you're seeing here, but would work for non-cross-object fields.
In the meantime the query is perfectly valid and if you run anonymous apex like:
List<Contact> conList=[SELECT Account.Owner.Name FROM Contact];
system.debug('conList->'+JSON.serialize(conList));
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi