How to send email notification on Task assignment using ToDo doctype

ERPNext was not sending email notifications when using the “Assign” button on a Task document. The built-in assignment notification was not working, and setting up a Notification with Document Type “Task” also did not work because the Task doctype does not have an assigned_to field that the notification system can use.
Use the ToDo doctype instead of Task in your Notification. Every time you assign someone to a document in ERPNext, the system automatically creates a new ToDo document behind the scenes. By listening to new ToDo creation and filtering by reference_type == "Task", we can trigger the notification at exactly the right moment.

Steps:

  1. Go to Setup → Notification → New

  2. Fill in:

    • Subject: New Task Assigned to You: {{ doc.reference_name }}

    • Document Type: ToDo

    • Send Alert On: New

    • Channel: Email

    • Condition: doc.reference_type == "Task"

  3. In Recipients, add a row and set Receiver By Document Field to allocated_to

  4. Write your message using these fields:

    • {{ doc.reference_name }} — Task name

    • {{ doc.description }} — Note added during assignment

    • {{ doc.assigned_by }} — Who assigned it

  5. Save

Why this works: When you click Assign on a Task, ERPNext creates a new ToDo with reference_type = "Task" and allocated_to = assigned person's email. The notification triggers on that new ToDo and sends the email automatically — no need to manually save the Task.

Note: If emails sit in the queue and don’t send automatically, SSH into your server and add a cron job to flush the queue every minute:

* * * * * docker exec frappe-backend-1 bench --site yoursite.com execute frappe.email.queue.flush
1 Like