global with sharing class OpportunityProductMirrorBatchScheduler implements Schedulable
This class creates the Opportunity Product Mirror records for the Opportunity Products that were updated since the last run or since the time that is specified in custom settings. It can be used as the object parameter to the System.schedule method that schedules the class to run at the time specified by the cron expression.
//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 code demonstrates how to create a new instance of the OpportunityProductMirrorBatchScheduler //class. It also demonstrates how this class is used to the System.schedule method //which schedules the class to execute in the specified by the cron expression time. //Create an instance of the class for project__c sobject type. ffrr.OpportunityProductMirrorBatchScheduler oppProductSchedulerSample = new ffrr.OpportunityProductMirrorBatchScheduler(); //Create the cron expression for every day for the whole year of 2017. String sampleCronExpression = '0 0 0 * * ? 2017'; //Run the System.schedule method and get the Job id. ID cronJobID = System.schedule('Test schedule', sampleCronExpression, oppProductSchedulerSample);