Please find below code to delete inactive accounts
global class batchAccountUpdate implements Database.Batchable<sObject> {
global Database.QueryLocator start(Database.BatchableContext BC) {
String query = 'SELECT Id FROM Account where Active__c=false';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Account> scope) {
delete scope;
}
global void finish(Database.BatchableContext BC) {
}
}
Please find below code to delete inactive accounts
Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant
P.S. If my answer helps you to solve your problem please mark it as best answer.