Step 1 : Create a Apex Class and copy past the below code in it
public class CronTrigger
{
public List<CronTrigger> listCronTrigger;
public void testing()
{
listCronTrigger = [select Id from CronTrigger where ( CronJobDetail.Name like 'yourjobname') limit 10];
System.debug('No of jobs: '+listCronTrigger.size());
If (listCronTrigger.size() > 0)
{
for (Integer i = 0; i < listCronTrigger.size(); i++)
{
System.abortJob(listCronTrigger[i].Id);
System.debug('Job details ::'+String.valueOf(listCronTrigger[i]));
}
}
}
}
Step 2 : Create a VF page and call testing method on load
On every page refresh 10 jobs will be deleted.
No comments:
Post a Comment