I have a scheduled job named "Scheduled_Mail" and its class is "Scheduled_Mail_Controller". From February 13, suddenly the following error occurs.

'Scheduled_Mail' : Dependent class is invalid and needs recompilation: Class Schedule_Notice_Batch_Controller : DML operation Delete not allowed on List<Notification__c>


global without sharing class Scheduled_Mail_Controller implements Schedulable {
    global void execute(SchedulableContext ctx) {
        Schedule_Notice_Batch_Controller noticeBatch = new Schedule_Notice_Batch_Controller();
        Database.executeBatch(noticeBatch, 200);


    public without sharing class Schedule_Notice_Batch_Controller implements Database.Batchable<sObject>{
    public Database.QueryLocator start(Database.BatchableContext bc) {
        String query = 'SELECT Id,CreatedDate FROM Notification__c ORDER BY CreatedDate DESC';
        return Database.getQueryLocator(query);

    public void execute(Database.BatchableContext bc, List<sObject> targetRecords) {
        List<Notification__c> deleteNoticeList = new List<Notification__c>();
        for(sObject s: targetRecords){
            if (Notification__c.sObjectType.getDescribe().isDeletable()){
                delete deleteNoticeList;
    public void finish(Database.BatchableContext bc) {

If you know how to solve this problem, please kindly tell me. Thank you.

  • 2
    Can you check if there is any delete operation trigger on the custom object you are trying to delete? Feb 18, 2022 at 8:15

1 Answer 1


This started failing in Spring '22. We have recently encountered this problem, too. This happens if you schedule a job from PostInstallHandler (my related question: Debug Logs for PostInstallHandler SuperUser).

For me, it helped to build new version of app in which I aborted previously scheduled jobs (that were scheduled from PostInstallHandler by a SuperUser mentioned in this question) and added possibility to run this scheduled job from real System Administrator (in my case - it is an Apex method called from VF page).

So the actual solution is to reschedule your jobs under actual System Administrator that has permissions on your managed package custom object on delete.

  • 1
    Thank you for your advice. Your solution worked and helped me a lot! And also as I thought it was Salesforce's bug, I opened a case about this issue and today Salesforce Support said they had resolved this bug. Now I confirmed the bug is fixed.
    – wanwan
    Mar 7, 2022 at 4:19
  • Cool, thank you for the update, I'll try it too! Mar 7, 2022 at 7:45

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.