You need to sign in to do that
Don't have an account?
Pervaz Allaudin
System.ListException: List index out of bounds: 0
I am doing thhe Trailhead excerize of process automation annd I get the
System.ListException: List index out of bounds: 0
It does not say how annd where.
I redid the the one picklist - Type. and the Field update functions and all the places where the pcklist values are referenced.
But I am still getting the error.
I have not learned the debug mode and not in the visual force language yet.
Could someone please direct me to solve the issue.
Thanks in advance.
Pevaz
System.ListException: List index out of bounds: 0
It does not say how annd where.
I redid the the one picklist - Type. and the Field update functions and all the places where the pcklist values are referenced.
But I am still getting the error.
I have not learned the debug mode and not in the visual force language yet.
Could someone please direct me to solve the issue.
Thanks in advance.
Pevaz
it means your list is null or empty.
and when it try to read list[0], error.
This means that your query has returned no records that match the criteria. If you then attempt to access an element at row 0, this will throw an error as that row doesn't exist.
If you then attempt to access an element at row 0, it'll throw an error as that row doesn't exist. It's good practice to check there are records first in order to make sure that the list is not empty before accessing it.
see:
Before referring to the 0th index of list you must perform a check on whether the list is empty or not. Whenever you try to access records from list first check if its empty or not.
Considerations for empty list
Regards