Using soql how can I get all the contacts from account via Opportunity object ? I have my button on Opportunity do i need subqueries for this scenario ?


You can try this code below:

SELECT Id, Name, (SELECT Id, Name FROM Contacts) FROM Account WHERE Id =: opp.AccountId

you can add other fields on the query if you want.

Hope that is helpful

  • hi @dibocor I paste your code on Conga Query 'Soql Statement' and gives me malformed query – Gavin Jun 7 '19 at 10:36
  • SELECT Name, ID, (SELECT NAME, Amount FROM Opportunities WHERE ID = '{pv0}'), (SELECT Id, LastName,Email FROM Contacts) FROM Account it gives me all the account w/ contacts hmm – Gavin Jun 7 '19 at 10:39

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.