I would like to schedule a job to run once in 15 minutes time.
According to this article:
I need to add some code to the finish
method:
public void finish(Database.BatchableContext context) {
AsyncApexJob a = [SELECT Id FROM AsyncApexJob WHERE Id = :context.getJobId()];
System.abortJob(a.id);
}
It seems to me that the SOQL
query is not required and that I could just run this line:
System.abortJob(context.getJobId());
Is that true? or am I missing something?
The documentation for method abortJob
says:
The jobId is the ID associated with either AsyncApexJob or CronTrigger.