+ Start a Discussion
NecroGigglesNecroGiggles 

Error: No such column 'ProductId'

I am trying to creat a map to grap the product ID that are added to the "opportunityLineItem" opject so I can show list price on a VF page. I am getting a error when trying to svae the code. 

"Error: Compile Error: No such column 'ProductId' on entity 'PricebookEntry'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. at line 209 column 66"

Am I using the wrong object?
public Map<Id, Double> listPriceMap {get; private set;}  

List<PricebookEntry> pricebookEntries = new List<PricebookEntry>([select Id, ProductId, UnitPrice from PricebookEntry where ProductId in :productIds]);
listPriceMap = new Map<Id, Double>(); 
for (PricebookEntry pbe : pricebookEntries) {  
    listPriceMap.put(pbe.ProductId, pbe.UnitPrice);

 
sandeep sankhlasandeep sankhla
Hi Necro,

These are Product2Id and procebookEntry2Id..please check and let me know if it works

Thanks
Sandeep
sandeep sankhlasandeep sankhla
Hey
use Product2Id it will work..
P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thanks,
Sandeep
Salesforce Certified Developer 
Ashish_Sharma_DEVSFDCAshish_Sharma_DEVSFDC
Hi Necro,

Always refer to workbench to get exact field names.

https://workbench.developerforce.com/login.php