Try ERPNext Buy Support Partners Foundation

Deleting notification log entries

I cant seem to find any documentation about deleting Notification Logs. As a test I assigned and then removed myself from a project 100 times. Now my notifications list has 200 entries that I cannot remove. Is there a way to remove these.

Assign Delete permission from Role Permission Manager on Notification Log doctype and then try to Delete the logs from Notification Logs doctype list view

Hello Manan_Shah
Thank you for responding.
I have trouble understanding the original purpose of the notification list when a user cant control it.
Not letting users easily manage things like notifications that are shoved into their faces seems odd to me so I wrote the following.
Adding it to a .js file in your apps public folder makes it work on every page.
It adds a delete button to each notification in the drop down list that appears when you click the bell.

frappe.after_ajax(function () {
var category_lists = document.getElementsByClassName('category-list');    
for (var i = 0; i < category_lists.length; i++) {
    let category_list = category_lists[i];       
    if (category_list.getAttribute("data-category") === "Notifications") {          

        var notifications = category_list.children;            
        for (var j = 0; j < notifications.length; j++) {               
            let notification_anchor = notifications[j];
            let name = notifications[j].getAttribute('data-name')
            var span = document.createElement('span');
            span.className = "text-muted";
            $(span).hover(

                function () {
                    $(this).css({"text-decoration":"underline"});
                });
            span.setAttribute('data-action',"delete-notification");
            span.setAttribute('data-name',name);
            span.textContent = "Delete";
            $(span).click(function(){
                frappe.call({
                    method: 'mypath.mypath.utilities.deleteNotification',
                    args: {
                        notification_name: name,

                    },
                    callback: function (r) {
                        category_list.removeChild(notification_anchor);
                    }
                });
            })
            notifications[j].appendChild(span);


        }
    }

}

});

The python function
mypath.mypath.utilities.deleteNotification
is as follows

@frappe.whitelist()
def deleteNotification(notification_name):
frappe.delete_doc(“Notification Log”, notification_name, ignore_permissions=True)