Explain the difference - product vs product2.

719    Asked by dipesh_9001 in Salesforce , Asked on Apr 28, 2023

I want to upsert a Product record using Apex.

When I write:

Product pr = new Product();
It gives an error "Invalid Type: Product".
but when I write
Product2 pr = new Product2();

Then no error occurs. Can anyone please explain the reason behind this.

Answered by Ella Clarkson

Products is the label while Product2 is the API name. In apex we use API name that's why you have to use Product2 to create a new instance. Product object is no longer available after API version 8.

Product2



Your Answer

Interviews

Parent Categories