force-app/main/default/classes/AgencyShareUpdateBatch.cls
@@ -30,6 +30,16 @@ } global void finish(Database.BatchableContext bc) { // 如果前一个603的batch正在等待状态,则取消掉前一个batch的执行 List<AsyncApexJob> lstJobs = [SELECT Id FROM AsyncApexJob WHERE (Status = 'Queued' OR Status = 'Holding') AND ApexClass.Name = 'NFM603Batch']; for (AsyncApexJob job : lstJobs) { try { System.abortJob(job.Id); } catch(Exception ex ) { System.debug(ex); } } Id execBTId = Database.executebatch(new NFM603Batch(),1); } }