Activity Forums Salesforce® Discussions Why do we put question mark in between cron expression is it mandatory in Salesforce?

  • Why do we put question mark in between cron expression is it mandatory in Salesforce?

    Posted by Deepak on January 22, 2020 at 3:41 pm
    public static String CRON_EXP = '0 0 0 15 3 ? 2022';

    Why do we put question mark in between cron expression is it mandatory?

     

    • This discussion was modified 4 years, 9 months ago by  Deepak.
    Arun replied 4 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Arun

    Member
    January 23, 2020 at 5:22 am

    Hi Deepak,

    A question mark ( ? ) in Scheduled Apex in Salesforce is allowed in the day-of-month and day-of-week fields. It is used to specify “no specific value,” which is useful when you need to specify something in one of these two fields, but not in the other.
    If you want a trigger to fire on a particular day of the month (for example, the 10th), but you don't care what day of the week that is, enter 10 in the day-of-month field, and ? in the day-of-week field.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos