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
sas619sas619 

List index out of bounds: 0 error when clicking on a button.

I am Facing an error in test environment after migrating the code from dev. When i click on a PDF report button which in turn would generate a visual force page as pdf format,it is showing List index out of bounds:0 error.Atleast it should display some account details as i have queried for that.

Noam.dganiNoam.dgani

Can you post some code and which line give you the error?

 

without the code I can a only tell you that you are accessing an index in an array, but the array doesn't have that index.

for example:

 

Account[] accs = new Account[1];

system.debug(accs[2]);

 

 

i would get the same error you got for my system debug line because my array size is 1 and I'm trying to reach the third element in the array - which doesn't exist.