Schedule every 5 minutes
datetime nextScheduleTime =
system.now().addMinutes(5);
string hours
=string.valueof(nextScheduleTime.hour());
string minute =
string.valueof(nextScheduleTime.minute());
string second =
string.valueof(nextScheduleTime.second ());
string cronvalue = second+' '+minute+' '+
hours+' * * ?' ;
string jobName = 'Test Scheduler
'+nextScheduleTime.format('hh:mm:ss');
ScheduleProfilePhotoUpload p = new
ScheduleProfilePhotoUpload();
system.schedule(jobName, cronvalue , p);
Id jobId
= sc.getTriggerId();
System.abortJob(jobId);
No comments:
Post a Comment