I'm stuck for one of the requirements .

Have to check the Status , Time and Name/created by of the Batch Schedular .Have a query working for CronTrigger for this but how do i implement it through Visualforce page ?

An example will help me to reach my destination.


Sharing some code I happen to have closely available, although not exactly what you're asking for, pretty close.

public class CronJob {
    public Id jobId { get; private set; }
    public String jobName { get; private set; } 
    public CronTrigger obj { get; private set; }

    public CronJob(CronTrigger ct) {
        jobId = ct.Id;
        jobName = ct.CronJobDetail.Name;
        obj = ct;

    public pageReference unschedule() {
        System.abortJob( jobId );
        return null;

public list<CronJob> getScheduledJobs() {
    list<CronJob> cj = new list<CronJob>();
    for (CronTrigger ct : [SELECT Id, CronJobDetailId, CronJobDetail.Name, 
            NextFireTime, PreviousFireTime, State, StartTime, EndTime, CronExpression, 
            CreatedBy.Name, CreatedDate, TimesTriggered from CronTrigger
            WHERE CronJobDetail.JobType = '7'
            ORDER BY CronJobDetail.Name]) {

        cj.add( new CronJob( ct ) );
    return cj;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.