Search code examples
salesforceapex-code

How do we schedule a class to run every 15 minutes in salesforce?


I am trying to schedule a class to run every 15 minutes. I know we can set in salesforce for every hour, but is there a way to reduce the granularity to 10-15 minutes?

global class scheduledMerge implements Schedulable {
  global void execute(SchedulableContext SC) {
      ProcessTransactionLog p= new ProcessTransactionLog();
      p.ProcessTransaction();
   }
}

Solution

  • You can use this apex code snippet to schedule your job to run every 15 minutes.

    System.schedule('Job1', '0 0 * * * ?', new scheduledMerge());
    System.schedule('Job2', '0 15 * * * ?', new scheduledMerge());
    System.schedule('Job3', '0 30 * * * ?', new scheduledMerge());
    System.schedule('Job4', '0 45 * * * ?', new scheduledMerge());