Popup message using frappe.publish_realtime

You are most Welcome :slight_smile: @rahy

Can you help with frappe.publish_realtime. In ERPNext there is Maintenance Schedule doctype in which Schedule date are generated in a child table. I want to display notification in any module one day before the scheduled date. I have written code which works properly to fetch proper date from the doctype. But somehow frappe.publish_realtime is not working

Hi @YogeshJoshi:

You can use Notification (not the same that Notification Doctype …)
This way:

from frappe.desk.doctype.notification_log.notification_log import enqueue_create_notification

notification_doc = {
		"type": "Alert",
		"subject": "I'm here. Where are you?",
		"from_user": frappe.session.user,
        "document_type":"Maintenance Schedule",
        "document_name": doc.name // your maintenance schedule doc
	}

enqueue_create_notification("recipient@mail.com", notification_doc)

This will show a desk alert and, depending on the recipient user configuration, mail would be sent too. Hope this helps.