• litt mann
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi guys!

I am getting the below error on this test. class:

Error: STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: []

 

Code:

@isTest
private class ActiveAccountTest{
    static testmethod void validateActiveAccount()
    {
        Account acc = new Account();
        acc.name= 'test';
        insert acc;
        
        Product2 newProd = new Product2 (Name = 'Test Product', ProductLine__c ='Test Product Line');
		insert newProd;
        
        Opportunity oppObj = new Opportunity(Name = 'TestOpp',AccountID = acc.Id,Amount = 2000,CloseDate=Date.today(),StageName='A - Purchase / Close Won', MarketingGeneratedType__c = 'Sales');
		insert oppObj;    
        
    	Pricebook2 customPB = new Pricebook2(Name='Test Product', isActive=true);
        insert customPB;
        
        PriceBookEntry pbEntry = new PriceBookEntry(UnitPrice = 100.00, PriceBook2Id = customPB.Id, Product2Id = newProd.Id, IsActive = true, UseStandardPrice = false);
		insert pbEntry ;

		OpportunityLineItem oppLine = new OpportunityLineItem(pricebookentryid=pbEntry.Id,TotalPrice=2000,Quantity = 1,OpportunityID = oppObj.Id);
		insert oppLine;
        
        Test.startTest();
            Account acct4 = [Select custombox__c from Account limit 1];
        Test.stopTest();
         }
}
Can anyone help with this? Any hints would be appreciated!