You need to sign in to do that
Don't have an account?
How do I create this SOQL query?
I'm trying to come up with a SOQL query that displays the following:
Account Name | Opportunity Closed Date (most recent, won) | Product Purchased | Opportunity Amount
So far I've only been able to get as far as this:
Account Name | Opportunity Closed Date (most recent, won) | Product Purchased | Opportunity Amount
So far I've only been able to get as far as this:
SELECT Account.Name, CloseDate, Amount, (SELECT Product2.Name FROM OpportunityLineItems) FROM Opportunity WHERE IsClosed = true AND StageName = 'Closed Won'
If this is not possible with SOQL, is it possible with Salesforce Reports? Thank you!
Your SOQL is correct, you just need to add ORDER BY clause to get most recent opportunities first.
Please find updated SOQL below:
Please mark it as best answer if the information is informative.
Thanks,
Suraj
a process builder should do the job: after an opportunity is closed/won, update the related Account to set a custom field (lookup to Opportunity) with the Id of the current Opportunity.
This way you have on each account a reference to its latest closed/won opportunity