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
Nicky123Nicky123 

Error In executing test code.

Hi,

I am receiving the following exception while running my test class.I am not getting its meaning.

please let me know if anyone know this.

 

 

"System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Product2Trigger: execution of AfterInsert caused by: System.ListException: List index out of bounds: 0 Class.Product2TriggerHandler.addPriceBookEntry: line 80, column 1 Trigger.Product2Trigger: line 26, column 1: []"

Noam.dganiNoam.dgani

Hard to tell without seeing your code, but:

 

in line 26 of Product2Trigger you are referencing a place in a list that has nothing in it.

for example - if i had a list/array with two objects in it, i could reference array[0] and array[1] without problem becuase it has something in those cells.

but if i tried to reference array[2], i would get the exception that you got becuase there is nothing there (no third object in the array).

 

hope this helps - if it does, kindly mark your post as resolved

Madhan Raja MMadhan Raja M

Hi Nicky,

 

Can you post your Test class?

 

Madhan Raja M