But getting error : Compile Error: Invalid type: OpportunityLineItems at line 12 column 5
27 risposte
Use this query
list<OpportunityLineItem> tprod=[SELECT Name,Quantity, UnitPrice, TotalPrice,PricebookEntry.Name, PricebookEntry.Product2.Family FROM OpportunityLineItem WHERE OpportunityId = :oppName.Id];
And to display the details you are using a Product2 that's why you are getting the errors. Use OpportunityLineItem.