ffrr.DeleteStagingTableRecordsSchedulerglobal with sharing class DeleteStagingTableRecordsScheduler implements Schedulable Deletes all data in the revenue recognition staging tables, regardless of factors such as user and recognition date. This should only be used in an administrative capacity and, if possible, the CalculationService.deleteLines method should be used instead. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. //Note: This sample demonstrates how to setup a scheduled task to run the //DeleteTableRecordsScheduler one year in the future. When the scheduled task //is run, DeleteTableRecordsScheduler's execute method will be called //Select today's date and add one year to it Date dtOneYearAhead = Date.today().addYears(1); //The scheduler task system uses a cron date (format: h m s d m ? y) so we need to construct that List<Integer> li = new List<Integer>{0, 0, 0, dtOneYearAhead.day(), dtOneYearAhead.month()}; String sCronDate = String.join(li, ' '); //Add all our strings together to get our final cron date (1 year in the future) sCronDate = sCronDate + ' ? ' + String.valueOf(dtOneYearAhead.year()); //Schedule the task to run String jobID = System.schedule('testDeleteScheduledApex', sCronDate, new ffrr.DeleteStagingTableRecordsScheduler()); Methodsexecuteglobal void execute(SchedulableContext sc) Input Parameters
|