Scheduling Apex jobs
To schedule an apex job hourly, fill in <ClassName> with the name of the class to be scheduled and <description> then run the following code in execute anonymous (see previous section).
String schedule = '0 0 * * * ?'; //This is hourly
String description = <description>; // The description shown when viewing job status and what is scheduled.
System.schedule(description,schedule, new <ClassName>());
The schedule string uses 6 numbers separated by spaces to define the schedule. They are, in order,
Seconds Minutes Hours Day_of_month Month Day_of_week
The special character * means every as in every hour, every day, every month. ?
means no value and is only available for day of month and day of week.
For help scheduling, visit Salesforce's Apex Scheduler developer documentation.
The tables below list available apex schedulable jobs, their recommended schedule, and how to run them on demand.
Class name | Interval | Schedule string | On demand | Description |
---|---|---|---|---|
MED_AnonymizerBatch | Hourly | '0 0 * * * ?' | Database.executeBatch(new mvn.MED_AnonymizerBatch()); | Deletes accounts according to the Anonymization Setting ( |
MED_NetworkRetrieveDCRBatchSched | Hourly | '0 0 * * * ?' | Database.executeBatch(new mvn.MED_NetworkRetrieveDCRBatchSched(),50); | Pulls the updated status on DCRs previously sent to Veeva Network. |
MED_NetworkSendDCRBatchSched | Hourly | '0 0 * * * ?' | Database.executeBatch(new mvn.MED_NetworkSendDCRBatchSched(),50); | Sends new DCRs to Veeva Network. |
MED_QAFlagCasesBatch | Monthly | '0 0 0 0 * ?' | Database.executeBatch(new mvn.MED_QAFlagCasesBatch(),1); | Flags Interactions for QA review according to the QA options in the Local Settings ( |
MED_VeevaMIRFPullBatchSched | Hourly | '0 0 * * * ?' | Database.executeBatch(new mvn.MED_VeevaMIRFPullBatchSched(),1); | Pulls new MIRFs from external Veeva CRM orgs. |
MED_VeevaMIRFUpdateBatchSched | Hourly | '0 0 * * * ?' | Database.executeBatch(new mvn.MED_VeevaMIRFUpdateBatchSched(),1); | Pushes the status of an Interaction back to the source MIRF. |
MED_VeevaMIRFPullLocalSched | Hourly | '0 0 * * * ?' | Database.executeBatch(new mvn.MED_VeevaMIRFPullLocalSched(),1); | Pulls new MIRFs from local Veeva CRM orgs. |
MED_VeevaMIRFUpdateLocalSched | Hourly | '0 0 * * * ?' | (new mvn.MED_VeevaMIRFUpdateLocalSched()).execute(null); | Pushes the status of an Interaction back to the source MIRF. |
Class name | Job name | Interval | Schedule string | On demand | Description |
---|---|---|---|---|---|
mvn.CM_ScheduledPublishJob | CM_Scheduled_Publish_Job_1 | Hourly | '0 0 * * * ?' | (new mvn.CM_ScheduledPublishJob()).execute(null); | Publishes any documents set to publish in the future. |
mvn.CM_ScheduledPublishJob | CM_Scheduled_Publish_Job_2 | Hourly | '0 10 * * * ?' | (new mvn.CM_ScheduledPublishJob()).execute(null); | |
mvn.CM_ScheduledPublishJob | CM_Scheduled_Publish_Job_3 | Hourly | '0 20 * * * ?' | (new mvn.CM_ScheduledPublishJob()).execute(null); | |
mvn.CM_ScheduledPublishJob | CM_Scheduled_Publish_Job_4 | Hourly | '0 30 * * * ?' | (new mvn.CM_ScheduledPublishJob()).execute(null); | |
mvn.CM_ScheduledPublishJob | CM_Scheduled_Publish_Job_5 | Hourly | '0 40 * * * ?' | (new mvn.CM_ScheduledPublishJob()).execute(null); | |
mvn.CM_ScheduledPublishJob | CM_Scheduled_Publish_Job_6 | Hourly | '0 50 * * * ?' | (new mvn.CM_ScheduledPublishJob()).execute(null); | |
mvn.CM_ExpiredDocumentsSchedulable | CM_Expired_Documents_Job_1 | Hourly | '0 0 * * * ?' | (new mvn.CM_ExpiredDocumentsSchedulable()).execute(null); | Expires documents on their expiration date. |
mvn.CM_ExpiredDocumentsSchedulable | CM_Expired_Documents_Job_2 | Hourly | '0 10 * * * ?' | (new mvn.CM_ExpiredDocumentsSchedulable()).execute(null); | |
mvn.CM_ExpiredDocumentsSchedulable | CM_Expired_Documents_Job_3 | Hourly | '0 20 * * * ?' | (new mvn.CM_ExpiredDocumentsSchedulable()).execute(null); | |
mvn.CM_ExpiredDocumentsSchedulable | CM_Expired_Documents_Job_4 | Hourly | '0 30 * * * ?' | (new mvn.CM_ExpiredDocumentsSchedulable()).execute(null); | |
mvn.CM_ExpiredDocumentsSchedulable | CM_Expired_Documents_Job_5 | Hourly | '0 40 * * * ?' | (new mvn.CM_ExpiredDocumentsSchedulable()).execute(null); | |
mvn.CM_ExpiredDocumentsSchedulable | CM_Expired_Documents_Job_6 | Hourly | '0 50 * * * ?' | (new mvn.CM_ExpiredDocumentsSchedulable()).execute(null); | |
mvn.CM_UpcomingDocumentExpirationSchedulable | CM_Upcoming_Document_Expiration_Job | Hourly | '0 0 * * * ?' | (new mvn.CM_Upcoming_Document_Expiration_Job()).execute(null); | Sends upcoming expiration reminder notifications. |
mvn.CM_CacheSObjectMetadataSchedulable | CM_Cache_Task_Metadata_Job | Monthly | '0 0 * * * ? ' | mvn.CM_CacheSObjectMetadataSchedulable('Task')); | Updates the Task metadata cache that is required to render workflow layouts. NoteScheduling must be done via execute anonymous. |
CM_CancelExpiredCheckedOutDocumentsBatch | CM_CancelExpiredCheckedOutDocumentsBatch | Daily | '0 0 * * * ?', | new mvn.CM_CancelExpiredCheckedOutDocumentsBatch() | Cancels documents that have been checked out to Microsoft 365 for 180 days or more. |
mvn.CM_CheckOutExpirationSchedulable | CM_CheckOutExpirationSchedulable | Daily | '0 0 * * * ?', | new mvn.CM_CheckOutExpirationSchedulable()); | Schedule daily notifications for Document Version check out expiration before they are frozen in the Microsoft 365 service. |