+ Start a Discussion
Internal PartnerInternal Partner 

Batch job doesn't send email on a specific date scheduled for every year

Hi all,

I scheduled a batch job last year to run every 1. January at 12:05 am in every year. The batch job sends an email to a Support CRM team.
On the 1. January this year the job didn't run.

I checked the Apex code and everything is ok. Today I scheduled the batch at certain times by testing it and it worked, it sent an email to the Supoort CRM team. Now I am wondering if the following lines to invoke the batch job are correct:
MY_BATCH_JOB sendEmailJob = new MY_BATCH_JOB();
        String sch = '00 05 00 1 1 ? *';
        system.schedule('BATCH Yearly Email Reminder', sch, sendEmailJob);
Is especially the line '00 05 00 1 1 ? *' correct or incorrect?
Raj VakatiRaj Vakati
Your scheduler job may be correct .. but the issues i guess is 
  1. Batch jobs /scheduler jobs run on the running user time zone so check the time zone correctly .. 
  2. Some time job execution may be delayed. please check 
Your cron expression looks good to me 
Internal PartnerInternal Partner
Hi Raj, thanks for responding. The batch scheduler is correct in fact. Yesterday I made a test just invoking as described in this thread and it sent me an email, so it worked. The problem is not the time or the code or the day the way I scheduled it. Probably Salesforce don't trigger actions when the day/time is too far away from the time day you first submitted the job.

I submitted or scheduled the job in October 2018 in order for it to start on the 1st January every year. But once on the 1st January this year our customer reported that they didn't receive the email. No idea why.