function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
David Tarvin 10David Tarvin 10 

apex specialist challenge 3

Hi all. I am stuck on Apex Specialist Challenge 3 - Schedule synchronization. I keep getting the following message:User-added imageI have tried to address this challenge 3 different ways:

1. Place System.schedule inside the class implementing the Schedulable interface
global class WarehouseSyncSchedule implements Schedulable {
    global void execute(SchedulableContext ctx) {
        WarehouseCalloutService.runWarehouseEquipmentSync();
    }

    global static void scheduleInventoryCheck() {
        WarehouseSyncSchedule inventoryCheck = new WarehouseSyncSchedule();
        String CRON_EXPR = '0 0 1 * * ?';
        System.schedule('Check Inventory', CRON_EXPR, inventoryCheck);
    }
}
Then in Developer Console, anonymous window, execute the following: WarehouseSyncSchedule scheduleInventoryCheck();
I have verified that this does in fact schedule the job to run as it should.
I have also tried changing the methods and class from global to public and also changing the class to public with sharing. Each of these changes result in a scheduled job, yet I get the same error message.


2. Put the System.schedule within the execute() method
global class WarehouseSyncSchedule implements Schedulable {

    global void execute(SchedulableContext ctx) {
        WarehouseCalloutService.runWarehouseEquipmentSync();
        WarehouseSyncSchedule scheduleInventoryCheck = new WarehouseSyncSchedule();
        String CRON_EXPR = '0 0 1 * * ?';
        System.schedule('InventoryCheck', CRON_EXPR, scheduleInventoryCheck);
    }

}
This doesn't actually schedule the job, but I thought I'd see if it would cause the class to be accepted. It didn't. Same error.

3. Put the System.schedule code itself in the anonymous window
For this one, I just had this in the class:

 
global class WarehouseSyncSchedule implements Schedulable {

    global void execute(SchedulableContext ctx) {
        WarehouseCalloutService.runWarehouseEquipmentSync();
    }
}

I then put the following in the anonymous window and executed:
WarehouseSyncSchedule scheduleInventoryCheck = new WarehouseSyncSchedule();
String CRON_EXPR = '0 0 1 * * ?';
System.schedule('Inventory Check', CRON_EXPR, scheduleInventoryCheck);
When I do that, the job does get scheduled, but again I get the same error about not implementing the Schedulable interface.
I am totally lost as to what could be wrong. Any help is appreciated.