Aborting Apex Jobs


THere is a way to abort Apex Jobs that can be easily acomplish from the developer console.
If you open an anonymous window in your developer console you can use the following SOQL.

/***************************************************************************
*
* Running this SOQL in an anonymous window will get information about all 
* active apex jobs in your org. 
*
****************************************************************************/
List<CronTrigger> crontList =
      [SELECT CreatedById, CreatedDate,
         CronExpression, CronJobDetailId, EndTime,Id,
             LastModifiedById,NextFireTime, OwnerId, PreviousFireTime, 
                  StartTime, State, TimesTriggered FROM CronTrigger];

//
//


CronTrigger “Contains schedule information for a scheduled job”.
Get the Id of the job you want to abort and execute this line on an anonymous window.

// This line will abort the first entry on the crontList. 
// You need to make sure you have the right job id.

system.abortJob(crontList[0].id); 

//
//

Leave a Reply

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