How to show pop up message to a specific user?

How to show pop up message to a specific user using js or python?

var my_message = This is a warning message!
alert (my_message);

You can use frappe.msgprint function too for the purpose.

2 Likes

i want to show pop message to a specific user only for an event.for example if i press save button in a doctype the pop up message should show only for the given user (message will be like user ‘user_name’ saved a ‘doctype_name’)

JS:

if(user=="user_login_id") {
    frappe.msgprint("{0} save the doctype {1}", [user, doctype_name]);
}

Python:

if frappe.session.user == "user_login_id":
    frappe.msgprint("{0} save the doctype {1}".format(frappe.session.user, doctype_name))
3 Likes

it is working only if specified user save a doctype.
i need like this.

there are two users in erpnext

1.user a
2.user b

both user a and b are logged in to erpnext.

if user a save a document type.pop up message should show for user b only.

i tried frappe.publish_realtime() but it is not working

for frappe.publish_realtime() to work socketio must be running.

how to run socketio in production mode

It automatically starts in production setup.

Check if it’s running

sudo supervisorctl status all

To setup socketio

bench setup socketio

https://frappe.github.io/frappe/user/en/bench/guides/setup-production.html

I am in production order

socket io working fine

frappe.publish_realtime() is not working.please check the attached picture

but pop up can not see for user hafeesk@gmail.com.i tried for all user but it is not working

try

frappe.publish_realtime(event='msgprint',message='hello',user='user@example.com')

Specify event, message and user parameter, refer

7 Likes

Working now.Thank you