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
Denis BraslavskiyDenis Braslavskiy 

Schedulable apex class staying "Queued" and then "Aborted"

Schedulable apex class staying "Queued" and then "Aborted"  but not executing.
 
global class woww_refresh_v2 implements Schedulable {
    
    public static void execute(SchedulableContext SC) {
       try{
        list<Challenge__c> chal = [SELECT Id, Start_Date__c 
                                       FROM Challenge__c 
                                       WHERE Is_Started__c=true];
            list<Participant__C> participants=[SELECT Id, Name__c
                                               FROM Participant__C];
            list<mdg_daily_tip__c> tips=[SELECT Description__c, Name
                                         FROM mdg_daily_tip__c
                                         WHERE Date__c=TODAY];
             
.......................

            Ch_Data__c challdata=new Ch_Data__c(
                                    status__c = status,
                                    ...
                                );
                                insert challdata;
     } catch(Exception e)
        {
                    
        }
   }
}

What can I do wrong? 
v varaprasadv varaprasad
Hi Denis,

Please remove try catch once and check which error is coming in debug logs.And add system.debugs to all lists.
Baesd on that we can fix the issue.

Thanks
Varaprasad
Denis BraslavskiyDenis Braslavskiy

Thanks, I try these but has no result.

I can easily execute this class manually, but when i try to run it on schedule it dont work and just stays in queue.

mukesh guptamukesh gupta
Hi Denis,

Can you please test this code and apply your code same :
global class RemindOpptyOwners implements Schedulable {

    global void execute(SchedulableContext ctx) {
        List<Opportunity> opptys = [SELECT Id, Name, OwnerId, CloseDate 
            FROM Opportunity 
            WHERE IsClosed = False AND 
            CloseDate < TODAY];
          }
    
}

and execute below code in scheduler:-

RemindOpptyOwners reminder = new RemindOpptyOwners();
// Seconds Minutes Hours Day_of_month Month Day_of_week optional_year
String sch = '20 30 8 10 2 ?';
String jobID = System.schedule('Remind Opp Owners', sch, reminder);

if you have any assistance then please let me know

Please mark this Answer as Best Answer!!!!

Regards
Mukesh