Scheduable Apex in Salesforce

To commence with, I will discuss what is the term Schedulable Apex. It means that you can schedule or execute an block of code at a particular time. You can either execute a class, a batch class, or a queueable class. In this blog I will elaborate all these methods to explain schedulable apex.

Schedulable Apex

The Apex Scheduler lets you delay execution so that you can run Apex classes at a specified time. To schedule jobs, write an Apex class that implements the Schedulable interface, and then schedule it for execution on a specific schedule.


Why : Minimizing the lot of manual effort in daily routine.

Used :

1. To update daily records

2. To run batch class daily or at a particular time.

3. To send an email at a given time.

4. Daily or weekly maintenance tasks


Ways:

1. From User interface

2. Programatically by system.schedule method

1. Schedulable Apex


To schedule any class or code you need to follow two steps :


1. First implement the Schedulable interface for the class