function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KnowledgeseekerKnowledgeseeker 

I'm getting too many DML Statements 151 error when trying to execute this code in the Developer Console...

for (CronTrigger cjob : [SELECT Id FROM CronTrigger WHERE CronJobDetail.JobType != '7'AND CronJobDetail.JobType != '4' AND CronJobDetail.JobType != '9']){System.abortJob(cjob .Id);
}
KnowledgeseekerKnowledgeseeker
This is supposed to Unschedule/remove scheduled Reports / Dashboards etc.
Chris  ByromChris Byrom
I would assume that you have more than 100 things that are being aborted. Presumably this is what is causing the DML error. You might try limiting your query to 100 items and see if that solves the error, then run your code multiple times as needed to clear up the jobs.