Skip to main content
1 answer
  1. Dec 13, 2022, 11:47 AM
    Hi,

    You can abort the jobs which are in queue as below.

     

    List<AsyncApexJob> jobs = [SELECT Id, Status FROM AsyncApexJob WHERE Status NOT IN ('Completed', 'Failed','Aborted')];

    for (AsyncApexJob job : jobs)

    {

    System.abortJob(job.Id);

    }

    And run the apex batch again.

    If this solution helps, Please mark it as best answer.

    Thanks,
0/9000