You need to sign in to do that
Don't have an account?

batch apex class to find the current class
Hi
I have Active__C field and Expiration_Date__c field. If the active__c Flag is true, then the Expiration_Date__c must be greaterthan current date.
I need to write Batch apex class for this requirement.This Batch apex class runs on thousands of records.
Please help me any one know how to write code for this.
Thanks
Babu
I have Active__C field and Expiration_Date__c field. If the active__c Flag is true, then the Expiration_Date__c must be greaterthan current date.
I need to write Batch apex class for this requirement.This Batch apex class runs on thousands of records.
Please help me any one know how to write code for this.
Thanks
Babu
global Database.QueryLocator start(Database.BatchableContext BC) {
String query = 'SELECT active__c,Expiration_date__c FROM yourobject WHERE active__c= TRUE ';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<yourobject> scope) {
for(yourobject x : scope)
{
x.Expiration_date__c = "Your Custom Date";
}Update scope;
}
global void finish(Database.BatchableContext BC) {
}
}