ERPNext Corepython

ERPNext Notification Control (Alerts)

Notification Control

A complete guide to staying informed about important business events in ERPNext using automatic email, SMS, and Slack notifications.

Staying on top of critical business events is essential for smooth operations. ERPNext's Notification Control (formerly known as Email Alerts) allows you to automate communication based on document changes.

Whether it's notifying a sales manager about a high-value order, alerting the warehouse team of a new delivery, or sending payment reminders to customers, Notification Control handles it all automatically.

Key Concepts

Important ideas to understand in this code

Triggers

Events that start the notification process. Common triggers include 'New' (document creation), 'Submit' (document finalization), 'Cancel', 'Save', or value changes in specific fields.

Learn more

Conditions

Logic checks to determine if the alert should be sent. You can use simple field comparisons or complex Python/JavaScript expressions to target specific scenarios (e.g., Grand Total > 10000).

Learn more

Recipients

Who receives the message? Recipients can be dynamic (document owner, customer contact), fixed email addresses, or specific system Roles (e.g., Accounts Manager).

Step-by-Step Tutorial

Follow along to understand how this code works

1

Access Notification List

Navigate to the Notification list to manage your alerts. You can find this by searching for 'Notification' in the awesome bar.

text
Search: Notification List
Next Step
2

Create New Notification

Click 'Add Notification'. Enter a descriptive Subject. In the 'Document Type' field, select the document you want to monitor (e.g., Sales Order, Leave Application).

yaml
Subject: High Value Order Alert
Document Type: Sales Order
Next Step
3

Set Trigger and Conditions

Choose when the alert sends (e.g., on 'Submit'). Add a condition if needed. For example, to alert only for orders above $5,000:

python
Send Alert On: Submit
Condition: doc.grand_total > 5000
Next Step
4

Configure Recipients

Define who gets the message. You can send to specific email fields (like `contact_email`) or to internal users by Role. You can also send to fixed email addresses.

yaml
Send To: Sales Manager (Role)
CC: ceo@example.com (Fixed)
Next Step
5

Design the Message

Draft your message content. You can use Jinja templating to include dynamic data from the document, such as the Customer Name or Grand Total.

jinja2
Hello,

A new high-value order {{ doc.name }} from {{ doc.customer_name }} amounting to {{ doc.grand_total }} has been submitted.

Regards,
ERP System

Common Issues & Solutions

Troubleshoot problems you might encounter

ERPNext Wiki | Finbyz Tech