function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Account objAccount = new Account(); objAccount.Name = 'Test'; Insert objAccount; Opportunity objOpporunity = new Opportunity(); objOpporunity.Name = 'Test Opporutnity'; objOpporunity.AccountId = objAccount.Id; objOpporunity.StageName = 'Closed Won'; objOpporunity.CloseDate = system.Today(); Insert objOpporunity; Product2 objProduct = new Product2(); objProduct.Name = 'Test'; objProduct.Description = 'Test'; objProduct.RevRec_StartDate__c = system.today(); objProduct.RevRec_EndDate__c = system.today().addDays(1); Insert objProduct; PriceBook2 pb2Standard = [select Id from Pricebook2 where isStandard=true]; PricebookEntry objPBEntry = new PricebookEntry(Pricebook2Id = pb2Standard.Id, Product2Id=objProduct.Id,UnitPrice=500,IsActive=true); Insert objPBEntry; OpportunityLineItem objLineItem = new OpportunityLineItem(); objLineItem.PriceBookEntryId = objPBEntry.Id; objLineItem.OpportunityId = objOpporunity.Id; objLineItem.Quantity = 1; objLineItem.Unitprice = 500; Insert objLineItem; OpportunityLineItem objLineItem = new OpportunityLineItem(); objLineItem.PriceBookEntryId = objPBEntry.Id; objLineItem.OpportunityId = objOpporunity.Id; objLineItem.Quantity = 1; objLineItem.Unitprice = 500; Insert objLineItem;
only Opportunity can have more than opportunity lineitem