function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SalesForce China beginnersSalesForce China beginners 

Test the problems in class Thank you for solving

I create test in class, appear a mistake

 

System.DmlException:Insert failed.First exception on row 0;

 

first error:CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, createPriceBookEntry

 

execution of AfterInsertcaused by:System.ListException List index out of bounds:

 

OTrigger.createPriceBookEntry:line 7

 

 

 

I really found the trigger, the following should be how to do? What is the problem?              Thank you

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

List out of bounds exception means that you tried to access an element of a list (aka array) that doesn't exist - for example, if you've tried to retrieve data via a soql call that has returned no rows but assumed there will always be one.

 

It would help to see the code.