How to Send Notification Only to Assigned Practitioner (Doctor) in Patient Appointment?

Hi all,

I’m trying to send a system notification in Frappe when a Patient Appointment is created with status "Open", but I want the notification to go only to the assigned doctor (Healthcare Practitioner).

What I’ve Done:

  • Created a notification on the Patient Appointment DocType.
  • Condition:
doc.status == "Open"
  • Recipient:
    • Role: Physician
    • Condition:
doc.practitioner == frappe.session.user

Problem:

Even with this condition, all users with the Physician role are getting notified — not just the one assigned in doc.practitioner.

I tried using:

  • doc.practitioner == frappe.session.user
  • “Receiver By Role” + Condition
  • “Receiver By Document Field”

But doc.practitioner is a Link to Healthcare Practitioner, not directly to a User, so notifications are not correctly scoped to the specific user.


What I Want:

I want the notification to be sent only to the User account of the assigned Healthcare Practitioner (i.e., doc.practitioner).

You can use **Notification DocType** to send system or email notifications.
or you can use frappe.sendmail()

Actually, I’m using that only. If I book an appointment for one doctor, it shows a system notification for all doctors who are assigned the role of physician. But if I book an appointment for Dr. Raju means I need to
Send a notification for Dr.Raju, not for other doctors who have the role of physician. Please find below attached screenshot.Here i tried add a condition of frappe.session.user.Can you guide me achieve the above scenario ?

You have to set Send Alert On on Value Change.
or refer to this or use frappe.sendmail

No, if any appointment is booked, I need to send a system notification to that particular doctor and not for all doctors. I don’t want to send an email notification

There are some options with that you can achieve this:

  1. Use Custom and send notification on on_insert() means status = “Open”

  2. Create Custom field with fieldtype Data and in options Email and set that Doctor’s email_id from user (Your custom logic) and set this custom field in Notification

in reciever by document field set the healthcare practitioner

But it only shows the owner as an option, it doesn’t show another field. Is there any way to add those fields as options?

you can add an email field in the appointment doctype and autofill it when a doctor is selected.

that email field will be visible in the dropdown to select in notifications

This will work for email notification, I need to send system notification only not Email Notification

This will work for email notification, I need to send system notification only not Email Notification for doctors

Hi there how are you the right way to solve this is to add another field in the appoitment doctype email
and fetch if from practitoiner document email
and send the notification based on that email
then it will only send notification to that practitioner and alos you can hide that field if neccesarry it will still work fine
and select the type system notification not email notification


If I choose System notification, I won’t show the email option on the receiver by the user; it shows only owner as option

Mark Email in Reciver mail field then it show it in drop down of notifcation

Can you explain this?

As image attached create data field in Customimizing doctype with filling email using custom code/ or maunal whom you want to send it and with marking Email in option filed


while creating notification select custom email option to whom you want to send it

What channel are you using in the notification doctype?

Email

Here I don’t want to send the email, for I just need to show system notification only