You need to sign in to do that
Don't have an account?
Paula Kern 4
soql from Opportunity to Account to Contact. Get Primary Contact name
Hi all,
I have a soql query where opportunity is the primary object. i need to add to it the Name of the primary contact from the Contact Object. I'm having trouble traversing the Opportunity to Account to Contact relationship. Can someone help please
I have a soql query where opportunity is the primary object. i need to add to it the Name of the primary contact from the Contact Object. I'm having trouble traversing the Opportunity to Account to Contact relationship. Can someone help please
SELECT Id, Name,
(SELECT Contact.Name FROM AccountContactRoles WHERE IsPrimary = TRUE),(select id,name from opportunities)
FROM Account WHERE Id in (select accountid from opportunity where id = '0060Y000002sQ4VQAU')
The idea is to use Account instead of Opportunity.
There are surely other alternatives.