How to send system (bell icon) notification on button click of doctype

As per the requirement I need to send notification on button click of doctype.

Is there any way to send system notification using client script or server script or using any other way?

@Darshana_Topiya Yes, you can create ToDo so that users get notified in the bell icon…

@aashishvashisht6 Thanks for reply. I created ToDo with appropriate user in ‘Allocated To’ field but it is not notifying that user in bell icon.

@Darshana_Topiya You can check in your email queue the email is sent to a particular user or not… If any email is there then obviously there is a new notification in the bell icon…

Is there a way to create ToDo using frappe code manually?

@Darshana_Topiya You can check the assign_to function after assigning, a new ToDo is created.

Here is how I see the code runs,

from frappe.desk.form.assign_to import add as add_assignment

add_assignment({
	"assign_to": [self.approver],
	"doctype": self.doctype,
	"name": self.name,
	"description": self.note,
})