I need to fetch UnitPrice value of PricebookEntry which has particuler ProductId. writting code below.

List<pricebookentry> sUnitPrice=[SELECT UnitPrice FROM PricebookEntry WHERE product2Id=:productid];
  if(sUnitPrice.size()>0) {
  for(pricebookentry singlePricebookentry:sUnitPrice)

But this code is giving Exception:-

Initial term of field expression must be a concrete SObject: List < PricebookEntry>

Pls Help.

Thanks in Advance..


not sure what you are trying to do (without looking into the complete code)..

but focusing just on the error, you should change this line in the for loop

iUnitPrice = sUnitPrice.UnitPrice;


iUnitPrice = singlePricebookentry.UnitPrice;
|improve this answer|||||
  • 1
    A lot of thanks, that's the catch. and that was a silly mistake. :) – Prabhat Ranjan Sep 8 '15 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.