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
Kamal Kishore SinghKamal Kishore Singh 

Apex Specialist- Schedule synchronization :

Hi Guys 

I have implemented the below class and also scheduled it . 

Still getting an error. 
Challenge Not yet complete... here's what's wrong: 
The Apex class does not appear to be implementing the execute() method.
Very sad to see was not able to complete in the first attempt after making everything right.

public class WarehouseSyncSchedule implements Schedulable {
  
    public void execute(SchedulableContext SC)
    {
        WarehouseCalloutService.runWarehouseEquipmentSync();
    }
    
}
Kamal Kishore SinghKamal Kishore Singh
It is also scheduled 

6/19/2016 1:50 PMScheduled ApexQueued 000Singh, Kamal WarehouseSyncSchedule 7072800001zrpLT

ActionJob NameSubmitted BySubmittedStartedNext Scheduled RunType
Manage | DelHowWeRollJobSingh, Kamal6/19/2016 1:50 PM 6/20/2016 1:00 AMScheduled Apex
Nitin SharmaNitin Sharma
Hi Kamal,

First create a object for batch class in public void execute method block after this call a method Database.executeBatch(batch class object name). Examlple given below.
global class ScheduleBatch Implements Schedulable 
{
    global void execute(SchedulableContext sc){
        BirthdayNotificationBatch sb = new BirthdayNotificationBatch();
        Database.executeBatch(sb);
    }   
}

Thanks,
Nitin Sharma
Kamal Kishore SinghKamal Kishore Singh
This is not a batch class. WarehouseCalloutService.runWarehouseEquipmentSync(); where runWarehouseEquipmentSync is static method.
Kamal Kishore SinghKamal Kishore Singh
Got the answer for scheduleable class the method should be global. 
As classes installed from manage package is public , you tend to mis this. There change the class and method to global

globalclass WarehouseSyncSchedule implements Schedulable {
  
    global void execute(SchedulableContext SC)
    {
        WarehouseCalloutService.runWarehouseEquipmentSync();
    }
    
}
Naveen ChoudharyNaveen Choudhary
Hi,

Use the following steps sequentially as mentioned : 

1. Create Schedule Apex from the Salesforce UI.

User-added image

2. Use the exact setting mentioned in below image : 
User-added image

3. WarehouseSyncSchedule class should be like this : 
 
global class WarehouseSyncSchedule implements schedulable {
  // implement scheduled code here
  global void execute(SchedulableContext sc){

      WarehouseCalloutService.runWarehouseEquipmentSync();
      
  }
}

This will help you to clear Apex Specialist #3 challenge.

Happy Trail Blazing :) 
Rajesh Ediga 1Rajesh Ediga 1
Can you provide the test class for this for reference to complete Test scheduling logic cahllenge ?
johny Bashajohny Basha
In addition to scheduling the job in WarehouseSyncSchedule . Need to schedule the job daily in Salesforce UI under Apex classes and schedule jobs.
 
Tushar SaxenaTushar Saxena

Hey Naveen,

Can we solve this problem entirely code based.. I mean not scheduling the class using UI.

Uttam JainUttam Jain
@Tushar Saxena: Yes we can do it entirely via apex code. We would need to create one more apex class to invoke this schedulable apex class. Please find below code for the same.

public class WarehouseSyncSchedulerInvoke 
{
   public static void invokeschedule()
   {
    WarehouseSyncSchedule reminder = new WarehouseSyncSchedule();
// Seconds Minutes Hours Day_of_month Month Day_of_week optional_year
String sch = '0 0 1 * * ?';
String jobID = System.schedule('Scheduled Equipment Sync', sch, reminder);
       System.debug(jobID);
}
}

 
CHEN FEIYANCHEN FEIYAN

global class WarehouseSyncSchedule implements Schedulable {
    global void execute(SchedulableContext ctx) {
        System.enqueueJob(new WarehouseCalloutService());
    }
}

Set up-Apex classes-Schedule Apex
User-added image
 
Prashanth HiremathPrashanth Hiremath
@CHEN FEIYAN, Can i get the test class for the below class:

global class WarehouseSyncSchedule implements Schedulable {
    global void execute(SchedulableContext ctx) {
        System.enqueueJob(new WarehouseCalloutService());
    }
}