[SalesForce] How to query for the Product Object

In trying to use a query based on product standard object in a Batch Apex program.

select name from product/products returns error even in Developer console.

Errors :

sObject type 'Product' is not supported.

select name from products
^ ERROR at Row:1:Column:18

sObject type 'products' is not supported. If you are attempting to use
a custom object, be sure to append the '__c' after the entity name.
Please reference your WSDL or the describe call for the appropriate
names.

Please advice.

Thanks all. Yes Product2 query is working.

Best Answer

The product object is actually called 'Product2'.

From the documentation

Products are represented by Product2 objects. The Product object is no longer available.

Try changing your SOQL to something like below

list<Product2> products = [Select Id, Name From Product2];
Related Topic