Skip to content

Cancelling Queued Rollups

James Simone edited this page Mar 30, 2023 · 3 revisions

This question originally came up in a discussion, but it's a useful tidbit if there are ever any "stuck" Rollup jobs. You can run the following in Anonymous Apex to get rid of these:

List<AsyncApexJob> queuedJobs = [
  SELECT Id
  FROM AsyncApexJob
  WHERE Status IN ('Queued', 'Processing')
  AND ApexClass.Name IN ('RollupAsyncProcessor', 'RollupDeferredFullRecalcProcessor', 'RollupFullBatchRecalculator')
  LIMIT 30
];
for (AsyncApexJob job : queuedJobs) {
  try {
      System.abortJob(job.Id);
  } catch (Exception e) { }
}