You need to sign in to do that
Don't have an account?
sparc1.3696571782628958E12
Scheduled the deletion of records based on a specific Criteria
Hi All
I wish to delete records from my Opportunity Object based on a criteria, i.e. for those where Amount < 500000.
I wish to schedule this such that this deletion automatically takes place on every specific date ( say 1st of every month).
Thanks in Advance!!!
Shiv
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
global class ScheduledApexForBulkDelete implements Schedulable {
global void execute(SchedulableContext ctx) {
//Bulk Delete of unwanted Record
//Your code to delete Opportunity based on criteria
}
public static testMethod void testschedule() {
Test.StartTest();
ScheduledApexForBulkDelete sh1 = new ScheduledApexForBulkDelete();
String sch = '0 0 23 * * ?';
System.assert(sch == '0 0 23 * * ?');
system.schedule('Test Territory Check', sch, sh1);
Test.stopTest();
}
}
You can can create this class and then go to Apex classes and click Schedule Apex.
In that section you select that class and select date-time when to run.
You can see the scheduled jobs in:-
SetUp -> Administration Setup -> Monitoring -> Scheduled Jobs
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks