Sample Code:
public String status {get;set;}
Id batchId;
/*Method to call the batch class*/
public void startBatch(){
batchAccountUpdate obj = new batchAccountUpdate();
batchid = Database.executebatch(obj);
}
/*Method to check the status of batch*/
public void checkStatus(){
AsyncApexJob aaj = [SELECT Status FROM AsyncApexJob WHERE ID =: batchId];
status = aaj.Status;
}
public String status {get;set;}
Id batchId;
/*Method to call the batch class*/
public void startBatch(){
batchAccountUpdate obj = new batchAccountUpdate();
batchid = Database.executebatch(obj);
}
/*Method to check the status of batch*/
public void checkStatus(){
AsyncApexJob aaj = [SELECT Status FROM AsyncApexJob WHERE ID =: batchId];
status = aaj.Status;
}
Cheers!!!