You need to sign in to do that
Don't have an account?
Hoysala
Test class for this anyone help
global class DS_CallsStatusUpdate implements Database.Batchable<sObject>,Schedulable { global Database.queryLocator start(Database.BatchableContext bc) { return Database.getQueryLocator('SELECT Id,OCE__Account__c,OCE__CallDateTime__c,OCE__Status__c FROM OCE__Call__c WHERE OCE__Status__c =\'draft\' AND OCE__CallDateTime__c<LAST_N_DAYS:2'); } global void execute(Database.BatchableContext bc, List<OCE__Call__c> scope) { List<OCE__Call__c> callLst = new List<OCE__Call__c>(); for(OCE__Call__c ca : scope) { ca.OCE__Status__c = 'Submitted'; callLst.add(ca); } system.debug('calls--'+callLst); UPDATE callLst; }
http://www.infallibletechie.com/2013/11/test-class-for-batch-apex-in-salesforce.html
Hope this helps.
Firstly you have to add the finish method in your batch class.
Follow this batch class: I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi