Last active
August 29, 2015 13:57
-
-
Save dcarroll/9610109 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class MyScheduler implements Schedulable { | |
global void execute(SchedulableContext ctx) { | |
// The query used by the batch job. | |
String query = 'SELECT Id,CreatedDate FROM Merchandise__c ' + | |
'WHERE Id NOT IN (SELECT Merchandise__c FROM Line_Item__c)'; | |
CleanUpRecords c = new CleanUpRecords(query); | |
Database.executeBatch(c); | |
} | |
global static void RunInOneMinute() { | |
Datetime d = Datetime.now(); | |
d.second(); | |
MyScheduler p = new MyScheduler(); | |
String second = d.second() + ' ', | |
minute = (d.minute() + 1) + ' ', | |
hour = d.hour() + ' ', | |
day = d.day() + ' ', | |
month = d.month() + ' ', | |
dayofweek = '? ', | |
year = d.year() + ''; | |
String sch = second + minute + hour + day + month + dayofweek + year; | |
System.debug('Schedule: \n' + sch); | |
system.schedule('One Time Pro', sch, p); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment