Scheduling an Apex class
We can schedule an Apex class using either the point-and-click Apex Scheduler, or programmatically using the System.schedule
method. Both options have pros and cons, which we will discuss as we see how to schedule an Apex class in this section.
Using the Apex Scheduler
The simplest way to schedule an Apex job is to use the built-in point-and-click Apex Scheduler. To access the scheduler, go to the Apex Classes page within the SETUP menu and press the Schedule Apex button, as highlighted in the following screenshot:
Upon clicking this button, you will be presented with the Apex Scheduler page, which will allow you to schedule an Apex class, as seen in the following screenshot. You need to provide the following values for your scheduled job:
As can be seen from the preceding screenshot, we have the following fields...