Activity Forums Salesforce® Discussions Why should we avoid nested loop in Salesforce Apex controller and how to achieve it?

  • Kumar

    Member
    February 4, 2017 at 7:31 am

    Hi Mohit,

    Nested loops should be avoided in Apex controllers because they may slow down the processing of the page or may hit the governing limits for the page.

    One easy way, and which gives some nice structure to the code is to make the inner loop a separate function, or minimize using loops altogether.

     

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos