+ Start a Discussion
dssadssa 

System.LimitException: Too many DML statements: 151

thedabblerthedabbler

I assume you are new to developing in Apex . Whatever DML operation you are doing inside the loop please get it out of that.Rather collect those in the list inside the loop and do DML later.

 

I can see there just by glancing:

 

update contact;

insert task;

 

These are inside for loop.So, this will hit the limit if you are looping a lot.

 

I hope that helps.

 

 

iBr0theriBr0ther

All DMLs, please just get out of the loop.