You need to sign in to do that
Don't have an account?
BrianWX
Possible Cron Job Bug
I have a schedule batch apex that execute this line of code:
When I executed my test code and output the cron job, this is what I have:
The cron expression I took directly from Apex Schedule documentation: https://developer.salesforce.com/docs/atlas.en-us.232.0.apexcode.meta/apexcode/apex_scheduler.htm
Did I miss anything?
Test.startTest(); String jobId = System.schedule('testSomeBatch', '0 0 13 * * ?', new ProcessScheduledBatch()); Test.stopTest();From the cron expression, it'd run every day at 1:00 PM.
When I executed my test code and output the cron job, this is what I have:
ct: CronTrigger:{Id=08e2f00000MEbhJAAT, CronExpression=0 0 13 * * ?, TimesTriggered=0, State=WAITING, NextFireTime=2022-10-21 20:00:00}I would expect it to have next run at 13:00:00 hour, not at 20:00:00 hour.
The cron expression I took directly from Apex Schedule documentation: https://developer.salesforce.com/docs/atlas.en-us.232.0.apexcode.meta/apexcode/apex_scheduler.htm
Did I miss anything?
In the UI, Go to the scheduled jobs and check with the name of testSomeBatch and what is the next schedule time.?
In your output it was past value
NextFireTime=2022-10-21 20:00:00
Thanks!!