Building skynet
Triggers that call batch processes are fairly common, but like we mentioned earlier, it's not a good practice to have two sets of code that perform the same function. Sometimes, it's just easier to have your batch process run nightly (or on some other regular basis). This ensures that you start the day fresh with a clean slate and a database full of accurate data. A fairly new method in Apex is now available that lets you schedule the execution of a batch class called System.scheduleBatch()
. The System.scheduleBatch()
method has four input parameters:
- Apex class: This is the Apex class that implements the
Database.Batchable
interface. - Job name: This is a string you use for easy reference.
- Minutes from now: This represents an integer ...
Get Learning Apex Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.