function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rahul JagtapRahul Jagtap 

Partner Lead and converted opportunity details

Hi Everyone, 

I am required query to get all leads and converted opportunity details created by all contacts for particular partner account?

Thanks in advance
srlawr uksrlawr uk
Sorry, I tried really hard to understand your requirement, but it seems a bit odd.. so I can't formulate an answer.


You want to "get all leads" and "converted opportunity details" that have come from all "contacts for a particular account"?

Leads don't come from contacts - contacts come from Leads, so I'm not sure how to do what you are asking? Perhaps if you could write you need down in "pseudocode" - logically - it might help us to understand what you are after. Also - you haven't said "what" you want from these leads and opportunities, so off the bat, you'll probably just get the IDs I guess?

For converted Opportunities, you can just do:
 
[SELECT Id FROM Opportunity WHERE AccountId = :accountId AND StageName = 'Closed Won']

and as far as I can tell, that will return all the "Closed Won" opportunities. There is also an isWon flag  and "probability" field that you could utilise depending on your stages/requirements.