Find your content:

Search form

You are here

What's the best way to get the Product information using opportunity line item?

 
Share

I want to get the product information using Opportunity line Item.What is the simplest way to query this?

Thanks very much.


Attribution to: Keepcalmncode

Possible Suggestion/Solution #1

SOQL allows you to traverse object relationships using dot notation, so for example to get to the Product (and its fields) via the Pricebook on the OpportunityLine you can do this...

Select PricebookEntry.Product2.Name From OpportunityLineItem

Then in Apex use the same path to access the field you need.

String productName = queriedOppLine.Product2.Name;

Attribution to: Andrew Fawcett
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/5323

My Block Status

My Block Content