SeeAllData=false and Pricebooks

When writing test cases with SeeAllData=false, you cannot access or insert Pricebooks.

Effectively this means that you cannot use SeeAllData=false when working with any test case involving products.

Salesforce indicated this was a known bug when this feature was first rolled out and were working on a fix, however I’ve yet to see any resolution to this.

Does anybody know if there’s a workaround currently?

Answer

There is still no resolution to this – the pre-release Summer 13 Apex docs still say to use seeAllData=true in this case:

http://www.salesforce.com/us/developer/docs/apexcodepre/Content/apex_testing_data_access.htm?SearchType=Stem&Highlight=SeeAllData

Attribution
Source : Link , Question Author : James Davies , Answer Author : Bob Buzzard

Leave a Comment