You need to sign in to do that
Don't have an account?
Andrew Morales 1
Donation Question: SOQL Query Contact ID Opportunities
Im sure this is super basic for some of you so hoping I can save some hours in my day by asking the larger community.
The question I am trying to answer is: How many Contacts have made a Donation with the Opportunity Name = "Foundation Donation" in 2017?
The nuance is:
Any help would be appreciated. Thank you!
The question I am trying to answer is: How many Contacts have made a Donation with the Opportunity Name = "Foundation Donation" in 2017?
The nuance is:
- We dont use Accounts
- We dont use Contact Roles for Opportunities
- We use a custom lookup field on the Opportunity Object called 'Donor_Contact'
- I dont need to return dollar amount (although would be helpful)
- I dont need to return any Contact meta data, strictly 'number of donors'.
Any help would be appreciated. Thank you!
If you are just looking for the count,
If you want the details of the Contacts, Let me know how it goes.
Query:
SELECT count()
FROM Contact
WHERE Id IN (SELECT Donor_Contact__r.Id FROM Opportunity WHERE Name = 'Foundation Donation' AND CALENDAR_YEAR(CloseDate) = 2017)
Error:
ERROR at Row:1:Column:72
The inner select field 'Donation_Contact__r.Id' cannot have more than one level of relationships
Any thoughts?