function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pallavic14Pallavic14 

Error for test class whcih was working fine

I have a test class which was moved to live a year ago. I run the test and i get error message

System.DmlException: Insert failed. First exception on row 0; first error: STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: []

I can't figure out why is this happening.
Sfdc CloudSfdc Cloud
Hi Pallavi

You need to define first standard price book.if you  are creating a product record, you must create a pricebookentry record where pricebookid is the ID of the standard price book with some value. You must use @isTest(SeeAllData=true) to query this ID value

Hope this helps :)
If this helps Please mark it as best answer to help others :)
Thanks