+ Start a Discussion

Query for Opportunity products

I'm quite new to SFDC and trying to find if there is a way to query all products associated with an opportunity.


The scenario is I have an opportunity and two associated products. I'm trying to get these products in custom VF page.


Any help is appreciated!


You could use a Semi-Joins, but this returns all of the Opportunities with Products (Line Items).



Select o.Name, (Select Quantity From OpportunityLineItems) From Opportunity o Where Id IN (SELECT OpportunityId FROM OpportunityLineItem WHERE Quantity > 0)




Hope that helps,



That is really helpfulful, can you query the Product family too.