apex テスト時の STANDARD_PRICE_NOT_DEFINED エラー
イシュー
- 商談商品のテストを行う際に、商談商品をinsertする必要があるのだが、標準価格を設定しないと「STANDARD_PRICE_NOT_DEFINED」になる
参考
- How to insert/upload new Products, Price Books & Opportunity Line Item via Data Loader?
- Pricebook..Standard Price??? - Salesforce Developer Community
- salesforce - How do I avoid STANDARD_PRICE_NOT_DEFINED when unit-testing an OpportunityLineItem in Apex v24.0? - Stack Overflow
- @isTest (seeAllData=true)
- How to set the "standard price" for a product2 object in Apex? - Salesforce Developer Community
- Not able to insert records to custom pricebook through apex - Stack Overflow
- Pricebook and PricebookEntry in TestMethod - Salesforce Developer Community
@isTest (seeAllData=true)
- StandardPrice データレコードは、デフォルトでは参照できない
- @isTest (seeAllData=true) アノテーションを付けることによって、標準価格に対して商談商品を追加することができる