How to get Product Id from Opportunity Line item in SOQL?

Sample Query:

SELECT PricebookEntry.Product2Id FROM OpportunityLineItem

PricebookEntry.Product2Id will give you the Product Id associated with that Opportunity Product(Opportunity Line Item).

If the above workaround didn't help you to fix the issue, use the below workaround.

Set the Apex class version 30.0 and more and then execute the below SOQL.

Sample Query:

SELECT Product2Id FROM OpportunityLineItem


No comments:

Post a Comment