You need to sign in to do that
Don't have an account?
sfadm sfadm
Anonymous window Too many SOQL queries: 101
In order to achieve mass update of my records I tried to execute the following script:
in Anonymous window in my Developer Console however I received the following message:
`System.LimitException: Too many SOQL queries: 101`
Please advise how to avoid such exception and execute my script successfully?
List<Task> taskList = [SELECT status, CalculatedWorkingHours__c FROM Task WHERE CalculatedWorkingHours__c = -1.0 AND status = 'Completed']; for(Task task :taskList) { task.CalculatedWorkingHours__c = 1.0; } update taskList; System.debug('taskList ' + taskList);
in Anonymous window in my Developer Console however I received the following message:
`System.LimitException: Too many SOQL queries: 101`
Please advise how to avoid such exception and execute my script successfully?
I have seen your code , you made a mistake in updating the query list variable.
create a one more list variable and add the query list variable to the newly created list var and update that variable.
try this code.
please mark it as best answer