Cron Trigger

By | December 24, 2019

Any job that is scheduled in the salesforce will be registered or CronTrigger object (which is available from version 17 and later).

If you want to know the status of the job, we can write a SOQL on CronTrigger object using jobid generated by system.schedule( ) method invocation.

Syntax:

cronTrigger cron = [select id,cronExpression from cronTrigger where id =: jobId];

cronTrigger ct = [select TimesTriggered , Nextfiretime from cronTrigger where id =: jobId];

Fields in CRON Trigger:

  1. CronExpression :  Used to initiate the Schedule.
  2. CronJobDetail : ID of the Cron Job Detail record containing more details about this Scheduled job.
  3. EndTime : The date and time when the job either finished or with finish.
  4. NextFierTime : The next date and time the job is scheduled to run null if the job is not scheduled to run again.
  5. OwnerID : Owner of the job.
  6. PreviousFireTime : The Most recent  date and time the job run . null if the job has not run before current local time.
  7. StartTime : The date and time when the most recent iteration of Scheduled job started.
  8. State : Current start of job (Waiting, Acquired, complete…) .
  9. TimeTriggered : The number of times this job has been triggered .
  10. TimeZonesIdKey : Returns the time Zone ID .
Share this...
Share on Facebook
Facebook
Email this to someone
email

Leave a Reply

Your email address will not be published. Required fields are marked *