1

I want to access Standard PriceBookEntry ID in my Test Class.

I know by using @isTest(SeeAllData=true) we can create one. But, my requirement is not to use (SeeAllData=true).

I also thought to make a Standard PriceBookEntry ID entry in Custom Setting and access it in Test Class, but here also without (SeeAllData=true) we can't access Custom Setting.

So, any workaround/solution for this?

6

This was updated recently. You can leave SeeAllData=false and still access the standard pricebook now. See link

Test.getStandardPricebookId

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.