function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
global class DeleteLead implements Database.Batchable<SObject> { global Database.QueryLocator start(Database.BatchableContext BC) { string query = 'select id from Lead; System.debug('-----------1'+query); return Database.getQueryLocator(query); } global void execute(Database.BatchableContext BC, List<Account>scope) { for(Lead acc:scope) if(scope.size()>0) system.debug('------------'+scope); delete scope; } global void finish(Database.BatchableContext BC) { system.debug('Lead Deleted'); } }
public class LeadSchedule implements Schedulable { public static void SchuduleMake() { String cron='0 0 22 ? * SAT *'; System.schedule('hello',cron,new Batch2()); } public void execute(SchedulableContext sc) { DeleteLead b=new DeleteLead(); Database.executeBatch(b); } }
First you have to create Batch class to delete the lead:
Then Create the Scheduler class: The Schedulable class will delete the lead every Saturday.
Hope it will help you If it resolves your query. please Mark the best answer.
Regards,
Suraj