You need to sign in to do that
Don't have an account?
Shoaib Iqbal
Inconsistent data CronJobDetail and CronJob
I and trying to modified my class but I can not because of the scheduler job.
At my Scheduler page system do not have any scheduler job. I query the CronJobDetail Object it has no record but CronJob has one.
I tried to remove it manually using abortJob but not luck, below is the log.
DEBUG LOG
31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
Execute Anonymous: List<CronTrigger> listCronTrigger = [Select c.TimesTriggered, c.TimeZoneSidKey, c.State, c.StartTime, c.PreviousFireTime, c.OwnerId, c.NextFireTime, c.LastModifiedById, c.Id, c.EndTime, c.CronJobDetail.JobType, c.CronJobDetail.Name, c.CronJobDetail.Id, c.CronJobDetailId, c.CronExpression, c.CreatedDate, c.CreatedById From CronTrigger c];
Execute Anonymous: If (listCronTrigger.size() > 0)
Execute Anonymous: {
Execute Anonymous: For (Integer i = 0; i < listCronTrigger.size(); i++){
Execute Anonymous: System.debug(listCronTrigger[0]);
Execute Anonymous: System.abortJob(listCronTrigger[i].Id); }
Execute Anonymous: }
17:15:38.059 (59060705)|EXECUTION_STARTED
17:15:38.059 (59073275)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
17:15:38.060 (60284345)|SOQL_EXECUTE_BEGIN|[1]|Aggregations:0|select c.TimesTriggered, c.TimeZoneSidKey, c.State, c.StartTime, c.PreviousFireTime, c.OwnerId, c.NextFireTime, c.LastModifiedById, c.Id, c.EndTime, c.CronJobDetail.JobType, c.CronJobDetail.Name, CronJobDetail.Id, CronJobDetailId, c.CronExpression, c.CreatedDate, c.CreatedById from CronTrigger c
17:15:38.086 (86241765)|SOQL_EXECUTE_END|[1]|Rows:1
17:15:38.086 (86465978)|SYSTEM_METHOD_ENTRY|[2]|LIST<CronTrigger>.size()
17:15:38.086 (86513327)|SYSTEM_METHOD_EXIT|[2]|LIST<CronTrigger>.size()
17:15:38.086 (86551207)|SYSTEM_METHOD_ENTRY|[4]|LIST<CronTrigger>.size()
17:15:38.086 (86567991)|SYSTEM_METHOD_EXIT|[4]|LIST<CronTrigger>.size()
17:15:38.086 (86637256)|SYSTEM_METHOD_ENTRY|[5]|System.debug(ANY)
17:15:38.086 (86776534)|USER_DEBUG|[5]|DEBUG|CronTrigger:{State=ACQUIRED, LastModifiedById=00550000001WgCWAA0, TimeZoneSidKey=America/Indiana/Indianapolis, NextFireTime=2014-09-15 21:22:00, OwnerId=00550000001WgCWAA0, CreatedById=00550000001WgCWAA0, TimesTriggered=0, CreatedDate=2014-09-15 21:17:00, CronJobDetailId=08a50000000WvogAAC, CronExpression=0 22 17 15 9 ? 2014, Id=08e50000000WxsMAAS, StartTime=2014-09-15 21:17:00}
17:15:38.086 (86790549)|SYSTEM_METHOD_EXIT|[5]|System.debug(ANY)
17:15:38.086 (86860446)|SYSTEM_METHOD_ENTRY|[6]|System.abortJob(String)
17:15:38.096 (96488469)|EXCEPTION_THROWN|[6]|System.StringException: Job does not exist or is already aborted.
17:15:38.096 (96593082)|SYSTEM_METHOD_EXIT|[6]|System.abortJob(String)
17:15:38.096 (96689618)|FATAL_ERROR|System.StringException: Job does not exist or is already aborted.
AnonymousBlock: line 6, column 1
17:15:38.748 (96737628)|CUMULATIVE_LIMIT_USAGE
17:15:38.748|LIMIT_USAGE_FOR_NS|(default)|
Number of SOQL queries: 1 out of 100
Number of query rows: 1 out of 50000
Number of SOSL queries: 0 out of 20
Number of DML statements: 1 out of 150
Number of DML rows: 1 out of 10000
Maximum CPU time: 0 out of 10000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 10
Number of Mobile Apex push calls: 0 out of 10
17:15:38.748|CUMULATIVE_LIMIT_USAGE_END
17:15:38.096 (96775017)|CODE_UNIT_FINISHED|execute_anonymous_apex
17:15:38.098 (98377837)|EXECUTION_FINISHED
At my Scheduler page system do not have any scheduler job. I query the CronJobDetail Object it has no record but CronJob has one.
I tried to remove it manually using abortJob but not luck, below is the log.
DEBUG LOG
31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
Execute Anonymous: List<CronTrigger> listCronTrigger = [Select c.TimesTriggered, c.TimeZoneSidKey, c.State, c.StartTime, c.PreviousFireTime, c.OwnerId, c.NextFireTime, c.LastModifiedById, c.Id, c.EndTime, c.CronJobDetail.JobType, c.CronJobDetail.Name, c.CronJobDetail.Id, c.CronJobDetailId, c.CronExpression, c.CreatedDate, c.CreatedById From CronTrigger c];
Execute Anonymous: If (listCronTrigger.size() > 0)
Execute Anonymous: {
Execute Anonymous: For (Integer i = 0; i < listCronTrigger.size(); i++){
Execute Anonymous: System.debug(listCronTrigger[0]);
Execute Anonymous: System.abortJob(listCronTrigger[i].Id); }
Execute Anonymous: }
17:15:38.059 (59060705)|EXECUTION_STARTED
17:15:38.059 (59073275)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
17:15:38.060 (60284345)|SOQL_EXECUTE_BEGIN|[1]|Aggregations:0|select c.TimesTriggered, c.TimeZoneSidKey, c.State, c.StartTime, c.PreviousFireTime, c.OwnerId, c.NextFireTime, c.LastModifiedById, c.Id, c.EndTime, c.CronJobDetail.JobType, c.CronJobDetail.Name, CronJobDetail.Id, CronJobDetailId, c.CronExpression, c.CreatedDate, c.CreatedById from CronTrigger c
17:15:38.086 (86241765)|SOQL_EXECUTE_END|[1]|Rows:1
17:15:38.086 (86465978)|SYSTEM_METHOD_ENTRY|[2]|LIST<CronTrigger>.size()
17:15:38.086 (86513327)|SYSTEM_METHOD_EXIT|[2]|LIST<CronTrigger>.size()
17:15:38.086 (86551207)|SYSTEM_METHOD_ENTRY|[4]|LIST<CronTrigger>.size()
17:15:38.086 (86567991)|SYSTEM_METHOD_EXIT|[4]|LIST<CronTrigger>.size()
17:15:38.086 (86637256)|SYSTEM_METHOD_ENTRY|[5]|System.debug(ANY)
17:15:38.086 (86776534)|USER_DEBUG|[5]|DEBUG|CronTrigger:{State=ACQUIRED, LastModifiedById=00550000001WgCWAA0, TimeZoneSidKey=America/Indiana/Indianapolis, NextFireTime=2014-09-15 21:22:00, OwnerId=00550000001WgCWAA0, CreatedById=00550000001WgCWAA0, TimesTriggered=0, CreatedDate=2014-09-15 21:17:00, CronJobDetailId=08a50000000WvogAAC, CronExpression=0 22 17 15 9 ? 2014, Id=08e50000000WxsMAAS, StartTime=2014-09-15 21:17:00}
17:15:38.086 (86790549)|SYSTEM_METHOD_EXIT|[5]|System.debug(ANY)
17:15:38.086 (86860446)|SYSTEM_METHOD_ENTRY|[6]|System.abortJob(String)
17:15:38.096 (96488469)|EXCEPTION_THROWN|[6]|System.StringException: Job does not exist or is already aborted.
17:15:38.096 (96593082)|SYSTEM_METHOD_EXIT|[6]|System.abortJob(String)
17:15:38.096 (96689618)|FATAL_ERROR|System.StringException: Job does not exist or is already aborted.
AnonymousBlock: line 6, column 1
17:15:38.748 (96737628)|CUMULATIVE_LIMIT_USAGE
17:15:38.748|LIMIT_USAGE_FOR_NS|(default)|
Number of SOQL queries: 1 out of 100
Number of query rows: 1 out of 50000
Number of SOSL queries: 0 out of 20
Number of DML statements: 1 out of 150
Number of DML rows: 1 out of 10000
Maximum CPU time: 0 out of 10000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 10
Number of Mobile Apex push calls: 0 out of 10
17:15:38.748|CUMULATIVE_LIMIT_USAGE_END
17:15:38.096 (96775017)|CODE_UNIT_FINISHED|execute_anonymous_apex
17:15:38.098 (98377837)|EXECUTION_FINISHED
in your org, have you checked Apex Jobs under Monitor in setup pages or scheduled jobs.there you will find the id of your job.use that id in system.abort(id).
regards
Nitesh