Getting started with Job.apex
Cron Expression Jobs
Job.apex provides full support to Salesforce Apex scheduled job cron expressions.
new Job('test', new CustomJob())
.everyDay()
.atHour(8)
.schedule();
// Schedule a job that runs at 8:00 everydaynew Job('test', new CustomJob())
.betweenDaysOfWeek('Mon', 'Fri')
.atHour(8)
.schedule();
// Schedule a job that runs at 8:00 every week daynew Job('test', new CustomJob())
.fromDay(1)
.everyDays(2)
.atHour(8)
.schedule();
// Schedule a job that runs at 8:00 every other day from day 1new Job('test', new CustomJob())
.inMonth('May')
.on2nd('Sun')
.atHour(8)
.schedule();
// Schedule a job that runs at 8:00 on the second Sunday of Maynew Job('test', new CustomJob())
.onLastWeekdayOfMonth()
.atHour(8)
.schedule();
// Schedule a job that runs at 8:00 on the last week day of every monthnew Job('test', new CustomJob())
.inMonth('Sept')
.onNearestWeekday(20)
.atHour(8)
.schedule();
// Schedule a job that runs at 8:00 on the nearest week day of 9/20