How to delete "due notification" in OF4 with automation JavaScript?

Hi - I’m trying to delete the default “due” notification that is added to tasks to trigger at their due date with an JavaScript automation:

It seems like the code below (from the Omni Automation website should work, but it doesn’t remove the “due” notification – only “before due” or “scheduled” notifications are removed).

(() => {
    var action = new PlugIn.Action(function(selection) {
        try {
            var sel = selection
            var selCount = sel.tasks.length + sel.projects.length 
            if(selCount > 0){
                sel.databaseObjects.forEach(item => {
                    if(item instanceof Project){
                        item.task.notifications.forEach(notif => item.task.removeNotification(notif))
                    } else if (item instanceof Task){
                        item.notifications.forEach(notif => item.removeNotification(notif))
                    }
                })
            } else {
                throw {name: "Selection Issue", message: "Please select projects and/or tasks."}
            }
        }
        catch(err){
            new Alert(err.name, err.message).show()
        }
    });

    // If needed, uncomment, and add a function that returns true if the current selection is appropriate for the action.
    /*
    action.validate = function(selection){

    };
    */
        
    return action;
})();

Can anyone modify this to remove the “due” notification as well?

Thanks!

I think due default notifications are not accesible in the API. That’s why you can’t remove them, I think.

I get an empty list if a due item doesn’t have any “before due” nor “scheduled” notifications.

Perhaps they do it for safety measures — they don’t want the user to accidentally remove the notification of an important “due” item by mistake. But I am just guessing.