Product vs Product2

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












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.







share|improve this question


















  • 6




    A long, long time ago, there was a Product object, along with a PriceBook object. However, it had some design flaws, and so salesforce.com retired it. However, because of their policy for backwards compatibility, they could not directly get rid of this object, nor was there a way to determine which behavior to invoke based on the name alone, so they introduced a new Product2 and Pricebook2. This allowed the old and new objects to coexist side by side. Today, we only use the *2 version of these objects.
    – sfdcfox
    Aug 22 at 11:09










  • @sfdcfox thanks for sharing. I don't think we can find it anywhere else.
    – Tushar Sharma
    Aug 22 at 11:20










  • @sfdcfox thanks for this helpful information.
    – Jahnvi Jasani
    Aug 22 at 11:23

















up vote
1
down vote

favorite












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.







share|improve this question


















  • 6




    A long, long time ago, there was a Product object, along with a PriceBook object. However, it had some design flaws, and so salesforce.com retired it. However, because of their policy for backwards compatibility, they could not directly get rid of this object, nor was there a way to determine which behavior to invoke based on the name alone, so they introduced a new Product2 and Pricebook2. This allowed the old and new objects to coexist side by side. Today, we only use the *2 version of these objects.
    – sfdcfox
    Aug 22 at 11:09










  • @sfdcfox thanks for sharing. I don't think we can find it anywhere else.
    – Tushar Sharma
    Aug 22 at 11:20










  • @sfdcfox thanks for this helpful information.
    – Jahnvi Jasani
    Aug 22 at 11:23













up vote
1
down vote

favorite









up vote
1
down vote

favorite











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.







share|improve this question














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.









share|improve this question













share|improve this question




share|improve this question








edited Aug 23 at 5:19

























asked Aug 22 at 10:52









Jahnvi Jasani

568




568







  • 6




    A long, long time ago, there was a Product object, along with a PriceBook object. However, it had some design flaws, and so salesforce.com retired it. However, because of their policy for backwards compatibility, they could not directly get rid of this object, nor was there a way to determine which behavior to invoke based on the name alone, so they introduced a new Product2 and Pricebook2. This allowed the old and new objects to coexist side by side. Today, we only use the *2 version of these objects.
    – sfdcfox
    Aug 22 at 11:09










  • @sfdcfox thanks for sharing. I don't think we can find it anywhere else.
    – Tushar Sharma
    Aug 22 at 11:20










  • @sfdcfox thanks for this helpful information.
    – Jahnvi Jasani
    Aug 22 at 11:23













  • 6




    A long, long time ago, there was a Product object, along with a PriceBook object. However, it had some design flaws, and so salesforce.com retired it. However, because of their policy for backwards compatibility, they could not directly get rid of this object, nor was there a way to determine which behavior to invoke based on the name alone, so they introduced a new Product2 and Pricebook2. This allowed the old and new objects to coexist side by side. Today, we only use the *2 version of these objects.
    – sfdcfox
    Aug 22 at 11:09










  • @sfdcfox thanks for sharing. I don't think we can find it anywhere else.
    – Tushar Sharma
    Aug 22 at 11:20










  • @sfdcfox thanks for this helpful information.
    – Jahnvi Jasani
    Aug 22 at 11:23








6




6




A long, long time ago, there was a Product object, along with a PriceBook object. However, it had some design flaws, and so salesforce.com retired it. However, because of their policy for backwards compatibility, they could not directly get rid of this object, nor was there a way to determine which behavior to invoke based on the name alone, so they introduced a new Product2 and Pricebook2. This allowed the old and new objects to coexist side by side. Today, we only use the *2 version of these objects.
– sfdcfox
Aug 22 at 11:09




A long, long time ago, there was a Product object, along with a PriceBook object. However, it had some design flaws, and so salesforce.com retired it. However, because of their policy for backwards compatibility, they could not directly get rid of this object, nor was there a way to determine which behavior to invoke based on the name alone, so they introduced a new Product2 and Pricebook2. This allowed the old and new objects to coexist side by side. Today, we only use the *2 version of these objects.
– sfdcfox
Aug 22 at 11:09












@sfdcfox thanks for sharing. I don't think we can find it anywhere else.
– Tushar Sharma
Aug 22 at 11:20




@sfdcfox thanks for sharing. I don't think we can find it anywhere else.
– Tushar Sharma
Aug 22 at 11:20












@sfdcfox thanks for this helpful information.
– Jahnvi Jasani
Aug 22 at 11:23





@sfdcfox thanks for this helpful information.
– Jahnvi Jasani
Aug 22 at 11:23











2 Answers
2






active

oldest

votes

















up vote
5
down vote



accepted











Products are represented by Product2 objects. As of API version 8.0,
the Product object is no longer available. Requests containing Product
are refused, and responses do not contain the Product object.




So You need to use Product2 in your query but the label is Product.



Product2



Represents a product that your org sells. This object has several fields that are used only for quantity and revenue schedules (for example, annuities).



Products are the items and services that you sell to customers. Each product can exist in multiple price books with different prices.



Reference:-



Product object






share|improve this answer





























    up vote
    2
    down vote













    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






    share|improve this answer




















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "459"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f229719%2fproduct-vs-product2%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      5
      down vote



      accepted











      Products are represented by Product2 objects. As of API version 8.0,
      the Product object is no longer available. Requests containing Product
      are refused, and responses do not contain the Product object.




      So You need to use Product2 in your query but the label is Product.



      Product2



      Represents a product that your org sells. This object has several fields that are used only for quantity and revenue schedules (for example, annuities).



      Products are the items and services that you sell to customers. Each product can exist in multiple price books with different prices.



      Reference:-



      Product object






      share|improve this answer


























        up vote
        5
        down vote



        accepted











        Products are represented by Product2 objects. As of API version 8.0,
        the Product object is no longer available. Requests containing Product
        are refused, and responses do not contain the Product object.




        So You need to use Product2 in your query but the label is Product.



        Product2



        Represents a product that your org sells. This object has several fields that are used only for quantity and revenue schedules (for example, annuities).



        Products are the items and services that you sell to customers. Each product can exist in multiple price books with different prices.



        Reference:-



        Product object






        share|improve this answer
























          up vote
          5
          down vote



          accepted







          up vote
          5
          down vote



          accepted







          Products are represented by Product2 objects. As of API version 8.0,
          the Product object is no longer available. Requests containing Product
          are refused, and responses do not contain the Product object.




          So You need to use Product2 in your query but the label is Product.



          Product2



          Represents a product that your org sells. This object has several fields that are used only for quantity and revenue schedules (for example, annuities).



          Products are the items and services that you sell to customers. Each product can exist in multiple price books with different prices.



          Reference:-



          Product object






          share|improve this answer















          Products are represented by Product2 objects. As of API version 8.0,
          the Product object is no longer available. Requests containing Product
          are refused, and responses do not contain the Product object.




          So You need to use Product2 in your query but the label is Product.



          Product2



          Represents a product that your org sells. This object has several fields that are used only for quantity and revenue schedules (for example, annuities).



          Products are the items and services that you sell to customers. Each product can exist in multiple price books with different prices.



          Reference:-



          Product object







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 22 at 11:06

























          answered Aug 22 at 11:01









          sanket kumar

          1,357117




          1,357117






















              up vote
              2
              down vote













              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






              share|improve this answer
























                up vote
                2
                down vote













                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






                share|improve this answer






















                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  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






                  share|improve this answer












                  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







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 22 at 10:58









                  Tushar Sharma

                  23.3k52044




                  23.3k52044



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f229719%2fproduct-vs-product2%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      Long meetings (6-7 hours a day): Being “babysat” by supervisor

                      Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                      Confectionery