+ Start a Discussion
LuciferLucifer 

Regarding Schedule jobs

Hi All,

 

I have a schedule job of email alerts for task due date. It runs every day at 7.00am and checks for task over dues. If I created a record at 1.00pm with the overdue coondition satisfying then do I get a mail instantaneously or I get mail when the scheduled job run tomorrow at 7.00 and sees this as overdue and maile me?

Best Answer chosen by Admin (Salesforce Developers) 
SFAdmin5SFAdmin5

just kick off your schedulable job with something like the below in the developer console to test it.  where it says 24 in red...that means the job will start at 24 minutes after the start of the hour.  so if it's 3:06 pm now, just change that 24 to a 7, and the job will run at 3:07

 


testJob s = new testJob();
string sch = '0 24 * * 1-12 ? *';
system.schedule('job1',sch,s);

All Answers

SFAdmin5SFAdmin5

if it's a scheduled batch job sending these emails then the email would be fired on the next 7am firing of the job.  you wouldn't get anything immediate unless a trigger or workflow rule fires the email instead of the scheduled job.  i think.

LuciferLucifer

Thanks Rob. But I need to see now if its actually working. My condition of due date is activity date -2. So I have created a task with due date 17th and Scheduled the job every day at 7.00am. SO could you give me any idea of what I need to do to get an isnstant result..  Do I need to change the scheduled job time?

SFAdmin5SFAdmin5

just kick off your schedulable job with something like the below in the developer console to test it.  where it says 24 in red...that means the job will start at 24 minutes after the start of the hour.  so if it's 3:06 pm now, just change that 24 to a 7, and the job will run at 3:07

 


testJob s = new testJob();
string sch = '0 24 * * 1-12 ? *';
system.schedule('job1',sch,s);

This was selected as the best answer