I need some job to be run on schedule every x hours. I see that official documentation claims that none special characters are allowed for hours portion of CRON expression, however, when I try on sandbox to execute the following code

System.schedule('Run Batch every five hours', '0 0 2/5 * * ?', new BatchScheduler('Batch') );

I don't receive any error or exception and it seems to be scheduling it every 5 hours. Since this is not documented I am not sure if I could rely on this to run on production.

Can I rely upon this undocumented feature to use in production code?

  • 1
    U can never rely on undocumented observations. They can change / cease to work at any time – Eric May 3 '17 at 8:35
  • However, these undocumented observations are suggested as an answer to another questions salesforce.stackexchange.com/questions/16841/… – Patlatus May 4 '17 at 7:27
  • I am not agreeing or disagreeing with you on the undocumented part. And yes there are answers like that everywhere. It does not change my comment. – Eric May 4 '17 at 12:26

Your Answer

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

Browse other questions tagged or ask your own question.