Is this a bug?

When I schedule a job via the Immediate Window using this command. . .

System.schedule('Batch Update Contacts (Daily at 2:00 PM)', '0 0 14 * * ?', new ScheduleBatchUpdate_Contacts());

. . . this is what shows up in Setup | Monitoring | Scheduled Jobs: scheduled job UI screenshot

The UI has it wrong: this job will run every day, NOT just on the first of each month.

  • 1
    It is either a bug, looking at the wrong job, record, etc or you did not run the code you thought you did. The cron string is correct and works fine for me – Eric Sep 12 '16 at 0:56

Yes, it's a bug, or, at minimum, an unimplemented feature. The problem is that cron strings can express more powerful combinations than the UI can. For example, if you want to run a job every 3 hours Monday, Wednesday, and Friday, the cron string can express this, but the UI cannot. Technically, even though you've specified this as "runs every day at 2 pm", the UI can't parse this configuration. I suspect that if you used something like "0 0 14 * * Sun,Mon,Tue,Wed,Thu,Fri,Sat", it'd probably render correctly (but don't quote me on this). The cron job will run as expected, despite the UI appearing incorrectly.

| improve this answer | |
  • You're right, this string can be used in the Immediate Window, and also shows up correctly in the Scheduled Jobs UI: '0 0 14 ? * Sun,Mon,Tue,Wed,Thu,Fri,Sat' – Ezra Kenigsberg Sep 13 '16 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.