Search code examples
apisalesforcesoql

Salesforce SOQL query to find an opportunity, given its parent account id?


How can you write a SOQL (Salesforce query language) query to find an opportunity, given its parent account's account id?

I want to do something like this (doesn't work though):

SELECT Id, Name FROM Opportunity WHERE AccountId = '003D000000f0gfH'

Solution

  • Your query is fine, but you don't have an AccountId, 003 prefixed ids are for contacts.