You need to sign in to do that
Don't have an account?
Sahil Yadav
Hello mates I am Stuck in Batch class the purpose of batch class to delete the records in org but its getting failed could any one help on this. This batch class is getting executed but not deleting any records from org
Batch Class public class personBatch implements Database.Batchable<sObject>{ public Database.QueryLocator start(Database.BatchableContext bc){ return Database.getQueryLocator([SELECT Id, CreatedDate, Name, Phone_No__c FROM Person__c Where CreatedDate = Today]); } public void execute(Database.BatchableContext bc, List<sObject> scope){ for (sObject sc : Scope){ delete sc; } } public void finish(Database.BatchableContext bc){ System.debug('Finish method is get executed'); } } ==================================================================== Schedulable Class public class personSchedule implements Schedulable { public void execute(SchedulableContext sc){ personBatch pB = new personBatch(); Database.executeBatch(pB,200 ); } } ================================================================= Log Code personSchedule pS = new personSchedule(); String cronExp = '00 00 5 * * ?'; String jobPerson= System.schedule('personScheduleJobs',cronExp,pS); System.debug(+jobPerson);
I dont see any issue with the batch. I used the same code to check on Account object and ran the batch anonymously this deleted the Accounts which were created. Can you check if this batch is Scheduled correctly and if this is running ant particular instance.
Thanks,