Batch Apex with Visualforce
Visualforce Controller Code:
public class RunBatchController{
public void RunBatch(){
// DeletionBatch is the batch you implemented.
DeletionBatch batch = new DeletionBatch();
Database.executeBatch(batch);
}
}
Visualforce Page Code:
<apex:page controller="RunBatchController">
<apex:commandButton action="{!RunBatch}" value="Delete Records"/>
</apex:page>
Visualforce Controller Code:
public class RunBatchController{
public void RunBatch(){
// DeletionBatch is the batch you implemented.
DeletionBatch batch = new DeletionBatch();
Database.executeBatch(batch);
}
}
Visualforce Page Code:
<apex:page controller="RunBatchController">
<apex:commandButton action="{!RunBatch}" value="Delete Records"/>
</apex:page>