Activity Forums Salesforce® Discussions how to fix list index out of bounds in Apex ?

  • Shweta

    Member
    June 30, 2020 at 1:52 pm

    It occurs when we are trying to access the value by index and the query is unable to fetch any records. We can add a not null check to each of 'if' statements or alternatively use the native isEmpty method.

  • Kirandeep

    Member
    June 30, 2020 at 2:48 pm

    Hi Ayush,
    System.ListException: List index out of bounds: This Exception occurs when we try to access an index that’s not in the List.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos