1

I have a process that create scheduledjobs every minute (someone else wrote it). It is scheduled every day at 8 then schedule itself until 20.

I know Salesforce should delete jobs older than 7 days old with completed or aborted status. But on ScheduledJobs screen i can see some jobs older than 6 months (for example).

Another example : I have dozen jobs (without future run) with created date = 2016-01-06 ...

I would like to clean this

If i try the query :

SELECT ApexClassId,CompletedDate,CreatedById,CreatedDate,ExtendedStatus,Id,JobItemsProcessed,JobType,LastProcessed,LastProcessedOffset,MethodName,NumberOfErrors,ParentJobId,Status,TotalJobItems 

FROM AsyncApexJob 

WHERE
 JobType = 'ScheduledApex'
 AND CREATEDDATE > LAST_MONTH

ORDER BY CREATEDDATE ASC

LIMIT 300

I get a very different result. For example I have only one row with a created date = 2016-01-06 ... (i have dozens on scheduledJobs screen).

purgeOldAsyncJobs(Date.today()) returns some results and some old jobs are deleted (i have only one job left for yesterday), but not all.

Old jobs are still there (more than 400).

Did I miss something ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.