1

This query works:

select name, UnitPrice, ProductCode, UseStandardPrice from PriceBookEntry

But this query fails with the complaint "No such column StandardPrice":

select name, UnitPrice, ProductCode, StandardPrice, UseStandardPrice from PriceBookEntry

StandardPrice is a standard field. Not one we have added.

For whatever clue it may be, I used Navatar's lister of object fields, and StandardPrice doesn't appear:

https://developer.salesforce.com/forums/?id=906F000000090fnIAA

Below I'm attempting to insert a picture that shows the StandardPrice field in my PriceBookEntry description.

See the StandardPrice field?

  • 1
    I don't see any standardprice as a standard field on pricebookentry object. Can you verify once? It will be the unitprice on pricebookentry – Anurag Jul 20 '16 at 19:13
  • Very interesting, Anurag. When I use the tool I mention above, that shows the "physical" fields, indeed it is UnitPrice. I don't know what this means. – user2171796 Jul 20 '16 at 19:58
  • I just noticed there's UnitPrice as well as StandardPrice. I was focusing on StandardPrice, but I'm sure UnitPrice was always there. So, why don't you see StandardPrice? There's no way we could have locally added a field to the "Standard Fields" is there? – user2171796 Jul 20 '16 at 20:01
  • It's apparently a "convenience" field. You can't readily get to it from the SOAP API, so apparently you can't get it from Apex code either. You could always write a query like "SELECT UnitPrice, Product2Id FROM PricebookEntry WHERE Product2Id IN (SELECT Product2Id FROM OpportunityLineItem WHERE Id IN :Trigger.new) AND Pricebook2.IsStandard = TRUE" or something like that. I don't see a way to get at the price directly. – sfdcfox Jul 21 '16 at 4:09

Your Answer

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

Browse other questions tagged or ask your own question.