+ Start a Discussion
Vishant ShahVishant Shah 

Scheduled jobs not executing

Hi Community,

In our org we have a schedule job that is supposed to execute everyday at 6pm and another at 8 pm. the job that runs at 6pm doesnot execute and the job at 8pm executes without fail. I have checked the settings of the schedule and it is set to run everyday as the job at 8pm.

Does anyone out here have any indications as to what it could be

Thanks
Vishant
EnreecoEnreeco
Hi,
the job of 6pm is not executing but remains simply appended?
We had the same problems in some of our clients orgs and we just asked the SF support: sometimes is related to the load of the servers in a given time or to the query too complex (or a combination of the two).

Vishant ShahVishant Shah
Yes, it just stays.

All the job does is delete a load of records and the batch at 8pm recreates them

EnreecoEnreeco
We had the same problem and contected the support to get why of this remains stuck.
They may add you some extra custom index filters.
Vishant ShahVishant Shah
you've had some luck there, they pointed me to Dev forum and said someone will answer.. i did say to them its a resourcing issue and not developer as the job doesnot error.
EnreecoEnreeco
We have premium support in that ORGs, but that's why :)
Can you paste the query?
Vishant ShahVishant Shah
global class BatchDeleteFinancialObjects implements Database.Batchable<sObject> {

    global final String Query;

    global BatchDeleteFinancialObjects(Integer size){
        Query = 'Select id from Financial_Transactional_Header_Data__c LIMIT ' + size;  
    }
    
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<Financial_Transactional_Header_Data__c> scope)
    {
        List<Financial_Transactional_Header_Data__c> flh = [Select Id From Financial_Transactional_Header_Data__c Where Id IN :scope];
        if(flh.size()>0){
            delete flh;
        }
    }
size in constructor is the number of records in the objeect, about 40k
Vishant ShahVishant Shah
There's no triggers or workflows set on this object that will fire something else

EnreecoEnreeco
Your query seems pretty slick.
You can try to add some filters to see if it speeds up the query, like some CreatedDate or LastMOdifiedDate based filter. 
Vishant ShahVishant Shah
Thank you!!

We need all the records deleted so filtering might throw this out, but may be i'll limit it to half of them and do partial deletes, i mean at the finish of batch check if there are any more and recall the same batch. 

Thinking about it, SFDC is not even executing the job