Convert an APEX Trigger into a Scheduled Batch Update


Goal is to use a Batch Class as scheduled job as well.


global class Schedule_BatchUpdate implements Database.Batchable, Schedulable { 

Then, add a Schedulable execute method that executes the Batch

public void execute(SchedulableContext sc) {
    Database.executeBatch(new CampaignInfluence_BatchUpdate());
System.schedule('Jobname', '0 30 2,6,10,14,18,22 * * ?', new CampaignInfluence_BatchUpdate());

The anonymous apex will start a schedulable job with the desired cron expression. When the job starts, its execute(SchedulableContext sc) method is called that then starts the batch job

Finally, unless this is a managed package, you can ditch the global and use public