Batch Apex Job Every 30 minutes
Batch Class :
global void finish(Database.BatchableContext info){ Datetime sysTime = System.now().addMinutes(30); String chronExpression = '' + sysTime.second() + ' ' + sysTime.minute() + ' ' + sysTime.hour() + ' ' + sysTime.day() + ' ' + sysTime.month() + ' ? ' + sysTime.year(); System.schedule( 'job -' + sysTime, chronExpression, new scheduledBatch()); }
Scheduled Class :
global class scheduledBatch implements Schedulable { global void execute(SchedulableContext SC) { Database.executeBatch(new BatchSearchForAccount()); system.abortJob(sc.getTriggerId()); } }