2

This question already has an answer here:

Is there any way through which i can schedule my apex job at the desired time recurring daily. I also want this job to recur after every 15 minutes sometimes. I went through some links including http://help.salesforce.com/apex/HTViewHelpDoc?id=code_schedule_batch_apex.htm and Scheduling an Apex Job through the ui however i can only find that we can schedule our job on a weekly or monthly basis, and that too at the time specified which we cannot modify. Please suggest of any way out so that i can schedule my job daily or recurring after every certain time in a day at a time which i can mention. Thanks in advance.

marked as duplicate by pjcarly, Saariko Jun 24 '13 at 13:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The UI for daily execution can be confusing because of the naming—just choose weekly and then check all the days! – Matt Lacey Jun 25 '13 at 2:21
1

Exactly as you say, go through the UI, schedule weekly... and then tick the box beside each of the seven days of the week.
enter image description here
You can specify the start time in the drop down at the bottom, although only to the nearest hour.
If you wanted to run the same job 4 times a day then you could achieve this through the UI by setting up four scheduled jobs for your class, one job for each desired start time. Note that you can only have 100 scheduled jobs in total.

For more specific requirements around timing and recurrence you can schedule it through code, there is some more information here, an example would look like this

proschedule p = new proschedule();
String sch = '0 0 8 13 2 ?';
system.schedule('One Time Pro', sch, p);

You would typically run this setup step as anonymous apex, through the developer console.
Cron expressions are really powerful and let you specify different recurrences, precise start times etc.
However remember that the start time you are specifying is the time you would like the job to start, and this is subject to resource availability on the platform.

  • Thanks, however, what if i want to run this batch four times a day? Also, what if i want to specify my own time like 3:15 am, then second time as 4:30 am, etc. – abc Jun 24 '13 at 11:14
  • For that kind of requirement you would need to schedule through code - I'll update the answer – Doug B Jun 24 '13 at 11:18
  • I'm not sure I understand exactly what you mean by that, can you explain? Cron is pretty flexible. For example if you want it to run regularly, e.g. every 4 hours or twice a day. Or alternatively if you want to specify starting times, e.g. at 5:00, 13:00, 16:00 and then 21:00 you can do that. Apex Cron doesn't support some of the features in second / minute scheduling. – Doug B Jun 24 '13 at 20:32

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