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 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.
All DMLs, please just get out of the loop.