You need to sign in to do that
Don't have an account?

How to query on "Opportunity_Product" Object ?????
Hi Friends,
I have a requirement to query on the standard object "Opportunity_Product".I don't know the object name to query.
Please help me.
Thanks,
Vijay
Regards,
Satish Kumar
All Answers
Regards,
Satish Kumar
parentOpportunitySet = Opportunity Id Set
List<OpportunityLineItem> opportunityLineItemList = [Select o.PricebookEntryId, o.OpportunityId, o.Id From
OpportunityLineItem o where o.OpportunityId = :parentOpportunitySet];
for(OpportunityLineItem opp : opportunityLineItemList){
pricebookEntryIdSet.add(opp.PricebookEntryId);
}
List<PricebookEntry> pricebookEntryList = [Select p.Product2Id, p.Name, p.Id From PricebookEntry p where Id= :pricebookEntryIdSet];
for(PricebookEntry p : pricebookEntryList){
productIdSet.add(p.Product2Id);
}
List<Product2> product2List =[Select p.Name, p.Id From Product2 p where Id = :productIdSet];
for(Product2 p2 : product2List){
opportunityProductNameList.add(p2.Name);
}
opportunityProductNameList will have all Product Names associated with Opportunity.
Product2 objetc is the Opportunity_Product object.
This will help you..
select name,opportunity.name from opportunitylineitem where name like 'widget%'