Automated Email Notifications from Business Rules
Introduction
Business events often require immediate stakeholder notification via email, whether alerting managers to approval requirements, notifying customers of status changes, or informing teams of exception conditions. Manual email generation creates delays, inconsistencies in message content, and missed notifications when users forget to send messages or lack awareness of notification requirements.
Email notification requirements typically include approval workflows (manager notification of pending approvals, escalation messages for overdue items), exception alerts (inventory below reorder points, orders exceeding credit limits), status updates (order confirmation to customers, shipment tracking to recipients), and compliance documentation (regulatory notifications, audit trail communications).
QUALIA Rule Engine's Email actions enable automatic email generation triggered by business rule conditions. Email actions support dynamic recipients (based on user roles, field values, or relationships), parametric message content (incorporating current record data, calculated values), attachment management (documents, reports, PDFs), and delivery control (immediate send, queued processing).
Email action capabilities:
Dynamic recipient determination from user tables, roles, or field values
Template-based message composition with field substitution
Subject line parameterization using record data
Body content with HTML formatting and data merge
Attachment configuration (reports, documents, files)
CC and BCC recipient management
Part 1: Basic Email Configuration
Simple Static Email
Basic email configuration with fixed recipients and static content demonstrates core email action structure.
Validation Set: Sales Order - Manager Notification - OnInsert
Rule 1: Notify Manager of Large OrdersTable: Sales Header (36)
Condition:
[36:109]
Action - Email:
To: [email protected]
Subject: Large Order Created
Body: A large sales order has been created requiring review.
Order No.: [36:3]
Customer: [36:2]
Amount: $[36:109]
Placeholders Used in This Email:
[36:109] - Sales Header (Table 36): Amount Including VAT (Field 109) - Total order amount
[36:3] - Sales Header (Table 36): No. (Field 3) - Order number
[36:2] - Sales Header (Table 36): Sell-to Customer No. (Field 2) - Customer number
Result: When order exceeds $100,000, automatic email sent to sales manager.
Multiple Recipients
Rule 2: Alert Multiple StakeholdersCondition:
[36:CustomRushOrder]
Action - Email:
To: [email protected], [email protected]
CC: [email protected]
Subject: Rush Order Alert - Order [36:3]
Body: Rush order requires immediate processing.
Order: [36:3]
Customer: [36:79]
Requested Ship Date: [36:CustomRequestedShipDate]
Placeholders Used in This Email:
[36:CustomRushOrder] - Sales Header (Table 36): Custom Rush Order Flag - Boolean flag for rush processing
[36:3] - Sales Header (Table 36): No. (Field 3) - Order number
[36:79] - Sales Header (Table 36): Sell-to Customer Name (Field 79) - Customer name
[36:CustomRequestedShipDate] - Sales Header (Table 36): Custom Requested Ship Date - Required ship date
Result: Rush orders trigger multi-recipient notification with copy to manager.
Part 2: Dynamic Recipients
Using Field Values for Recipients
Email recipients can be determined dynamically from field values in current or related records.
Validation Set: Sales Order - Sales Rep Notification - OnModify
Rule 1: Notify Assigned SalespersonSource References:
1. Salesperson/Purchaser (13)
Link via: [36:15] = [13:1]
Condition:
[36:120]
Action - Email:
To: [13:CustomEmail]
Subject: Order [36:3] Released for Processing
Body: Your sales order has been released.
Order No.: [36:3]
Customer: [36:79]
Amount: $[36:109]
Expected Ship Date: [36:CustomExpectedShipDate]
Placeholders Used in This Email:
[36:15] - Sales Header (Table 36): Salesperson Code (Field 15) - Assigned salesperson
[13:1] - Salesperson/Purchaser (Table 13): Code (Field 1) - Salesperson code for linking
[13:CustomEmail] - Salesperson/Purchaser (Table 13): Custom Email Field - Dynamic recipient email
[36:120] - Sales Header (Table 36): Status (Field 120) - Order status field
[36:3] - Sales Header (Table 36): No. (Field 3) - Order number
[36:79] - Sales Header (Table 36): Sell-to Customer Name (Field 79) - Customer name
[36:109] - Sales Header (Table 36): Amount Including VAT (Field 109) - Order amount
[36:CustomExpectedShipDate] - Sales Header (Table 36): Custom Expected Ship Date - Expected shipping date
Result: Email automatically sent to salesperson assigned to the order.
Role-Based Recipients
Rule 2: Notify User GroupValidation Set: Item - Low Inventory Alert - OnModify
Source References:
1. User Setup (91)
Reference Filters:
[91:CustomReceiveInventoryAlerts]
Condition:
[27:Inventory] <= [27:15]
Action - Email:
To: ALL([91:CustomEmail])
Subject: Low Inventory Alert - [27:3]
Body: Item inventory has reached reorder point.
Item No.: [27:1]
Description: [27:3]
Current Inventory: [27:Inventory]
Reorder Point: [27:15]
Reorder Quantity: [27:16]
Placeholders Used in This Email:
[91:CustomReceiveInventoryAlerts] - User Setup (Table 91): Custom Receive Inventory Alerts Flag - Boolean for alert subscription
[91:CustomEmail] - User Setup (Table 91): Custom Email Field - User email addresses (ALL function for group distribution)
[27:Inventory] - Item (Table 27): Inventory (Field 18) - Current inventory quantity
[27:15] - Item (Table 27): Reorder Point (Field 15) - Minimum inventory threshold
[27:1] - Item (Table 27): No. (Field 1) - Item number
[27:3] - Item (Table 27): Description (Field 3) - Item description
[27:16] - Item (Table 27): Reorder Quantity (Field 16) - Standard reorder quantity
Result: All users configured for inventory alerts receive notification.
Part 3: Parametric Message Content
Field Value Substitution
Message subject and body can incorporate field values using bracketed field references.
Validation Set: Customer - Credit Limit Warning - OnModify
Rule 1: Warn Finance of Credit Limit ApproachSource References:
1. Customer Ledger Entry (21)
Link via: [18:1] = [21:3]
Reference Filters:
[21:13]
Condition:
SUM(21:14) > [18:59]
Action - Email:
To: [email protected]
Subject: Credit Limit Warning - [18:2] ([18:1])
Body: Customer approaching credit limit.
Customer: [18:2]
Customer No.: [18:1]
Credit Limit: $[18:59]
Current Balance: $[SUM(21:14)]
Available Credit: $[18:59 - SUM(21:14)]
Utilization: [SUM(21:14) / [18:59]
Placeholders Used in This Email:
[18:1] - Customer (Table 18): No. (Field 1) - Customer number
[21:3] - Customer Ledger Entry (Table 21): Customer No. (Field 3) - Link to customer
[21:13] - Customer Ledger Entry (Table 21): Open (Field 13) - Boolean for open entries
[21:14] - Customer Ledger Entry (Table 21): Amount (Field 14) - Outstanding amount
SUM(21:14) - Aggregate calculation: Total outstanding balance from all open ledger entries
[18:59] - Customer (Table 18): Credit Limit (Field 59) - Maximum credit allowed
[18:2] - Customer (Table 18): Name (Field 2) - Customer name
[18:59 - SUM(21:14)] - Calculated expression: Available credit remaining
[SUM(21:14) / [18:59] * 100] - Calculated expression: Credit utilization percentage
Result: Finance receives detailed credit utilization information automatically calculated and formatted.
Calculated Values in Messages
Rule 2: Include Derived MetricsValidation Set: Sales Order - Profitability Alert - BeforePost
Source References:
1. Sales Line (37)
Link via: [36:3] = [37:3]
2. Item (27)
Link via: [37:6] = [27:1]Condition:
([SUM(37:22) - SUM(27:22) * SUM(37:15)]
Action - Email:
To: [email protected]
Subject: Low Margin Order - [36:3]
Body: Order posting with below-target profit margin.
Order No.: [36:3]
Customer: [36:79]
Total Amount: $[SUM(37:22)]
Estimated Cost: $[SUM(27:22) * SUM(37:15)]
Profit: $[SUM(37:22) - SUM(27:22) * SUM(37:15)]
Margin: [([SUM(37:22) - SUM(27:22) * SUM(37:15)]
Placeholders Used in This Email:
[36:3] - Sales Header (Table 36): No. (Field 3) - Order number\n- [37:3] - Sales Line (Table 37): Document No. (Field 3) - Links to sales header
[37:6] - Sales Line (Table 37): No. (Field 6) - Item number
[27:1] - Item (Table 27): No. (Field 1) - Item number for linking
[36:79] - Sales Header (Table 36): Sell-to Customer Name (Field 79) - Customer name
[37:22] - Sales Line (Table 37): Unit Price (Field 22) - Selling price
SUM(37:22) - Aggregate calculation: Total sales amount from all lines
[27:22] - Item (Table 27): Unit Cost (Field 22) - Item cost
[37:15] - Sales Line (Table 37): Quantity (Field 15) - Line quantity
SUM(27:22) * SUM(37:15) - Calculated expression: Total estimated cost (sum of unit cost × quantity)
[SUM(37:22) - SUM(27:22) * SUM(37:15)] - Calculated expression: Total profit (revenue minus cost)
[([SUM(37:22) - SUM(27:22) * SUM(37:15)]) / SUM(37:22) * 100] - Calculated expression: Profit margin percentage
Result: Manager alerted to low-margin orders with calculated profitability metrics.
Part 4: Conditional Message Content
IF Statements in Message Body
Message content can include conditional logic for dynamic content assembly.
Validation Set: Purchase Order - Vendor Communication - OnRelease
Rule 1: Generate Vendor Order ConfirmationSource References:
1. Vendor (23)
Link via: [38:4] = [23:1]Action - Email:
To: [23:102] // E-Mail field on Vendor
Subject: Purchase Order [38:3] - [IF([38:CustomRushOrder] is true, 'RUSH', 'Standard')]
Body:
Dear [23:2],
Purchase Order [38:3] has been issued.
Order Date: [38:20]
Requested Receipt Date: [38:73]
[IF([38:CustomRushOrder] is true, 'PRIORITY: This is a RUSH order requiring expedited processing.', '')]
Order Details:
Total Amount: $[38:91]
Payment Terms: [38:64]
[IF([23:CustomPreferredVendor] is true, 'As a preferred vendor, you may qualify for early payment discount.', '')]
Please confirm receipt and expected ship date.
Best regards,
[CompanyName]
Placeholders Used in This Email:
[38:4] - Purchase Header (Table 38): Buy-from Vendor No. (Field 4) - Links to vendor
[23:1] - Vendor (Table 23): No. (Field 1) - Vendor number for linking
[23:102] - Vendor (Table 23): E-Mail (Field 102) - Vendor email address
[38:3] - Purchase Header (Table 38): No. (Field 3) - Purchase order number
[38:CustomRushOrder] - Purchase Header (Table 38): Custom Rush Order Flag - Boolean for rush processing
[23:2] - Vendor (Table 23): Name (Field 2) - Vendor name
[38:20] - Purchase Header (Table 38): Order Date (Field 20) - Date order created
[38:73] - Purchase Header (Table 38): Requested Receipt Date (Field 73) - Expected delivery date
[38:91] - Purchase Header (Table 38): Amount Including VAT (Field 91) - Total purchase amount
[38:64] - Purchase Header (Table 38): Payment Terms Code (Field 64) - Payment terms
[23:CustomPreferredVendor] - Vendor (Table 23): Custom Preferred Vendor Flag - Boolean for preferred status
IF statements - Conditional expressions: Dynamic content based on rush order and vendor status
Result: Email content adapts based on rush status and vendor preferred status.
Multiple Conditional Sections
Rule 2: Approval Request with ContextValidation Set: Sales Order - Approval Request - OnRelease
Condition:
[36:109] > 50000 OR [36:CustomCustomerRisk]
Action - Email:
To: [36:CustomApproverEmail]
Subject: Approval Required - Order [36:3]
Body:
Sales Order Approval Request
Order: [36:3]
Customer: [36:79]
Amount: $[36:109]
Approval Required Because:
[IF([36:109] > 100000, '• Order exceeds $100,000 threshold', '')]
[IF({[36:109] > 50000 && [36:109] <= 100000}, '• Order exceeds $50,000 threshold', '')]
[IF([36:CustomCustomerRisk] is 'High', '• Customer classified as high risk', '')]
[IF([Customer:CustomPastDue] > 0, '• Customer has past due balance: $' + [Customer:CustomPastDue], '')]
[IF([36:CustomRushOrder] is true, 'URGENT: Rush order requiring approval within 24 hours.', 'Standard approval process applies.')]
Click here to approve: [ApprovalLink]Result: Approval request email explains specific reasons requiring approval with contextual details.
Part 5: Email with Attachments
Attaching Reports
Email actions can include report attachments generated from current record data.
Validation Set: Sales Order - Customer Order Confirmation - OnRelease
Rule 1: Send Order Confirmation with PDFSource References:
1. Customer (18)
Link via: [36:2] = [18:1]Condition:
[18:CustomSendOrderConfirmation]
Action - Email:
To: [18:102]
CC: [36:CustomSalespersonEmail]
Subject: Order Confirmation - [36:3]
Body:
Dear [18:2],
Thank you for your order!
Order No.: [36:3]
Order Date: [36:20]
Expected Ship Date: [36:CustomExpectedShipDate]
Your order confirmation is attached.
Questions? Contact your sales representative at [36:CustomSalespersonEmail].
Best regards,
[CompanyName] Sales Team
Attachments:
- Report: "Standard Sales - Order Conf." (1305)
Filter: Sales Header No. = [36:3]
Result: Customer receives order confirmation email with PDF attachment of order details.
Multiple Attachments
Rule 2: Compliance DocumentationValidation Set: Item - Safety Data Sheet Distribution - OnModify
Condition:
[27:CustomHazardousMaterial]
Action - Email:
To: [RecipientList]
Subject: Safety Data Sheet - [27:3]
Body:
Updated safety documentation for hazardous material.
Item: [27:1] - [27:3]
Last Updated: [T]
Attached Documents:
- Safety Data Sheet (SDS)
- Handling Instructions
- Emergency Procedures
Review and acknowledge receipt.
Attachments:
- Report: "Item SDS" (Custom50001)
Filter: Item No. = [27:1]
Result: Complete safety documentation package automatically distributed.
Part 6: Advanced Email Patterns
Escalation Workflows
Email actions can implement escalation logic for overdue items or unresolved conditions.
Validation Set: Sales Order - Approval Escalation - Scheduled
Rule 1: Escalate Overdue ApprovalsTable: Sales Header (36)
Condition:
[36:120] is 'Pending Approval'
AND [36:CustomApprovalRequestDate] < [T]
Action - Email:
To: [36:CustomApproverManagerEmail]
CC: [36:CustomApproverEmail]
Subject: ESCALATION - Overdue Approval - Order [36:3]
Body:
Approval overdue - manager escalation.
Order: [36:3]
Customer: [36:79]
Amount: $[36:109]
Approval Requested: [36:CustomApprovalRequestDate]
Days Pending: [T - [36:CustomApprovalRequestDate]]
Original Approver: [36:CustomApproverName]
This order has been pending approval for [T - [36:CustomApprovalRequestDate]] days.
Immediate action required.
Approve or reject: [ApprovalLink]Result: Overdue approvals escalated to manager automatically.
Digest Emails
Rule 2: Daily Summary EmailValidation Set: System - Daily Order Summary - Scheduled Daily
Source References:
1. Sales Header (36)
Reference Filters:
[36:20] is [T]
Action - Email:
To: [email protected]
Subject: Daily Sales Summary - [T]
Body:
Sales Activity Summary for [T]
Orders Created Today: [COUNT(36:*)]
Total Value: $[SUM(36:109)]
Average Order Value: $[AVG(36:109)]
Breakdown by Salesperson:
[FOR EACH Salesperson:
[Salesperson:Name]: [COUNT(Orders)] orders, $[SUM(Orders:Amount)]
]
Rush Orders: [COUNT(36:* WHERE [36:CustomRushOrder] is true)]
Orders Pending Approval: [COUNT(36:* WHERE [36:120] is 'Pending Approval')]
High Value Orders (>$50K):
[LIST(36:3, 36:79, 36:109 WHERE [36:109] > 50000)]
Full report attached.
Attachments:
- Report: "Daily Sales Analysis" (Custom50010)
Filter: Order Date = [T]
Result: Management receives daily sales summary with key metrics.
Exception-Based Notifications
Rule 3: Inventory Shortage AlertValidation Set: Sales Line - Inventory Check - OnValidate
Condition:
[37:15] > [Item:Inventory]
Action - Email:
To: [email protected]
CC: [Salesperson:Email]
Subject: Inventory Shortage - Order [37:3], Item [37:6]
Body:
Inventory shortage detected on sales order line.
Order No.: [37:3]
Customer: [SalesHeader:79]
Item: [37:6] - [Item:3]
Ordered Quantity: [37:15]
Available Inventory: [Item:Inventory]
Shortage: [37:15 - [Item:Inventory]]
Outstanding PO Quantity: [Item:CustomOnPurchaseOrders]
Expected Next Receipt: [Item:CustomNextReceiptDate]
[IF([Item:CustomOnPurchaseOrders] >= [37:15 - [Item:Inventory]
Result: Inventory shortages trigger coordinated notification to inventory management and sales.
Part 7: Email Best Practices
Message Design Guidelines
Clear subject lines:
Structured body content:
Recipient Management
Validate email addresses:
Verify field contains valid email format
Provide fallback recipients for missing addresses
Use user setup tables for centralized email management
Test with internal addresses before production deployment
Example validation:
IF([Customer:102] is not '', [Customer:102]
Performance Considerations
Minimize email volume:
Use digest emails for high-frequency events
Implement threshold logic to prevent alert fatigue
Consider time-based batching (hourly, daily summaries)
Example throttling:
Condition:
[Field] meets criteria
AND [LastNotificationDate] < [T]
Testing Checklist
Before deploying email actions:
Verify recipient email addresses are valid
Test with various field value combinations
Confirm message formatting (line breaks, spacing)
Validate field references resolve correctly
Check attachment generation and file size
Test with null/empty field values
Verify CC and BCC recipients receive copies
Confirm email delivery (check spam folders)
Test conditional content logic branches
Review email content for clarity and professionalism
Summary and Key Takeaways
This guide covered automated email notifications using QUALIA Email actions in Microsoft Dynamics 365 Business Central:
Basic configuration with static recipients and message content
Dynamic recipients from field values, user roles, or relationships
Parametric content incorporating field values and calculated metrics
Conditional messages with IF statement logic for adaptive content
Attachments including reports, documents, and compliance materials
Advanced patterns covering escalations, digests, and exception alerts
Practical applications:
Approval workflow notifications with context and escalation
Customer communications (order confirmations, status updates)
Exception alerts (inventory shortages, credit limits, delays)
Compliance documentation distribution
Management reporting (daily summaries, performance metrics)
Team coordination (task assignments, handoff notifications)
Implementation exercise: Create an approval notification system:
Identify approval trigger conditions (amount thresholds, risk factors)
Configure dynamic approver determination based on rules
Design approval request email with contextual details
Implement escalation for overdue approvals
Test with various order scenarios and amounts
Monitor email delivery and approval response times
Related topics:
Blog 026: Assign Actions (updating notification tracking fields)
Blog 028: Confirmation Dialogs (user prompts vs. email notifications)
Blog 030: Understanding Scenarios (timing of email triggers)
Blog 032: Testing and Debugging (email action troubleshooting)
This blog is part of the QUALIA Rule Engine series for Microsoft Dynamics 365 Business Central. Follow along as we explore business rule automation patterns.
