Activity Forums Salesforce® Discussions What is a Cron trigger in Salesforce Apex?

  • Prachi

    Member
    August 16, 2018 at 1:26 pm

    Hi Anurag,

    Cron trigger Contains schedule information for a scheduled job. CronTrigger is similar to a cron job on UNIX systems. This object is available in API version 17.0 and later.

    Example:-

    List<CronTrigger> jobs = [Select Id, CronJobDetail.Name, State, NextFireTime From CronTrigger limit 10];
    for(CronTrigger job : jobs)
    {
    System.debug(job);
    }

    thanks.

  • Avnish Yadav

    Member
    August 16, 2018 at 1:27 pm

    Hi Anurag,

    CronTrigger-
    Contains schedule information for a scheduled job. CronTrigger is similar to a cron job on UNIX systems. This object is available in API version 17.0 and later.

    Usage - Use this object to query scheduled jobs in your organization.

    Thanks.

  • madhulika shah

    Member
    August 16, 2018 at 1:32 pm

    Hi Anurag,

    Cron Trigger contains schedule information for a scheduled job. Cron Trigger is similar to a cron job on UNIX systems. This object is available in API version 17.0 and later.

    It has several fields like CronExpression, CronJobDetailId, EndTime etc. To know more about these fields and their description, please refer to the link provided:

    https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_crontrigger.htm

  • Parul

    Member
    September 21, 2018 at 2:07 pm

    Contains schedule information for a scheduled job. CronTrigger is similar to a cron job on UNIX systems. This object is available in API version 17.0 and later.

    CronTrigger object in Salesforce

    All the scheduled jobs are stored in CronTrigger object in Salesforce.

    To view the Scheduled Jobs in Salesforce, check the below steps:

    1. Go to Setup --> Jobs --> Scheduled Jobs.

    2. Scheduled Jobs lists all of the jobs scheduled by your users. Multiple job types may display on this page. You can delete scheduled jobs if you have the permission to do so.

    Sample Query:

    SELECT ID, CronExpression, CronJobDetail.Name, CronJobDetailId, EndTime, NextFireTime, PreviousFireTime, StartTime, State, TimesTriggered FROM CronTrigger

     

    Thanks

Log In to reply.

Popular Salesforce Blogs