Activity Forums Salesforce® Discussions How to use CRON expression in Batch Class in Salesforce?

  • How to use CRON expression in Batch Class in Salesforce?

    Posted by Deepak on June 5, 2020 at 5:19 PM

    How to use CRON expression in Batch Class in Salesforce?

    Shweta replied 6 years ago 2 Members · 1 Reply
  • 1 Reply
  • Shweta

    Member
    June 8, 2020 at 2:40 PM

    In Scheduler class, we can execute at a specified time. What we are trying to do is Schedule a Batch. E.g.:
    SendEmailToAccountAndContactBatch schedulable = new SendEmailToAccountAndContactBatch();
    String sch = ‘0 0 13 ? MON,TUE,WED,THU,FRI ‘;
    system.schedule(‘SendEmailToAccountAndContactBatch’, sch, schedulable);
    database.executebatch(schedulable);

Log In to reply.