Custom Validation Messages for Business Rules
Introduction
Standard validation in Business Central provides generic error messages that often lack context about specific business rule violations. Users see messages like "You cannot delete this record" or "The value is not valid" without understanding what rule was violated, why the rule exists, or how to correct the issue.
Effective validation messages should explain what rule was violated, why the rule is important, what impact the violation would have, and specifically how to correct the issue. Poor messaging leads to user frustration, repeated errors, support tickets, and workarounds that bypass business rules.
QUALIA Rule Engine's Message actions enable custom validation messages that provide contextual information, explain business rules clearly, suggest corrective actions, and include dynamic data from current records. Messages can be informational (warnings that allow continuation), blocking (errors that prevent operation), or conditional (shown only when specific conditions met).
Message action capabilities:
Custom error messages that block operations
Warning messages that inform but allow continuation
Dynamic message content with field value substitution
Conditional message display based on rules
Multi-line formatted messages with structured information
Messages with corrective action guidance
Part 1: Basic Validation Messages
Simple Blocking Message
Basic validation message that prevents operation from completing demonstrates core message action structure.
Validation Set: Customer - Delete Validation - OnDelete
Rule 1: Prevent Deletion with Open Balance
Table: Customer (18)
Condition:
Action - Message:
Placeholders Used in This Example:
[18:62]- Customer (Table 18): Balance (LCY) (Field 62) - Current account balance[18:2]- Customer (Table 18): Name (Field 2) - Customer name displayed in messageCondition check:
[18:62] <> 0- Validates balance is non-zeroMessage type: Error - Blocks the delete operation from completing
Result: Deletion blocked with clear explanation of constraint.
Warning Message (Non-Blocking)
Rule 2: Warn About Inactive Customer
Validation Set: Sales Order - Customer Status Check - OnInsert
Condition:
Action - Message:
Result: User warned but can proceed with order creation.
Part 2: Messages with Context
Including Field Values
Messages incorporating field values provide specific context about rule violations.
Validation Set: Sales Order - Credit Limit Validation - OnRelease
Rule 1: Block Credit Limit Violation
Source References:
Condition:
Action - Message:
Placeholders Used in This Example:
[36:2]- Sales Header (Table 36): Sell-to Customer No. (Field 2) - Links order to customer[18:1]- Customer (Table 18): No. (Field 1) - Customer number for linking and display[18:2]- Customer (Table 18): Name (Field 2) - Customer name in message[21:3]- Customer Ledger Entry (Table 21): Customer No. (Field 3) - Links ledger entries to customer[21:13]- Customer Ledger Entry (Table 21): Open (Field 13) - Filter for open entries (false = not yet paid)[21:14]- Customer Ledger Entry (Table 21): Remaining Amount (Field 14) - Outstanding balance on entrySUM(21:14)- Aggregate function: Total of all open ledger entry amounts (current balance)[36:109]- Sales Header (Table 36): Amount Including VAT (Field 109) - Current order amount[18:59]- Customer (Table 18): Credit Limit (LCY) (Field 59) - Customer's credit limitSUM(21:14) + [36:109]- Calculated expression: Total exposure (existing balance + new order)SUM(21:14) + [36:109] - [18:59]- Calculated expression: Amount over limitCondition:
SUM(21:14) + [36:109] > [18:59]- Checks if total exposure exceeds credit limitSource Reference filtering: Filter
[21:13] is falseconfigured in linked table setup
Result: User receives detailed credit analysis and clear corrective actions.
Calculated Values in Messages
Rule 2: Inventory Shortage Details
Validation Set: Sales Line - Inventory Check - OnValidate
Source References:
Condition:
Action - Message:
Placeholders Used in This Example:
[37:6]- Sales Line (Table 37): No. (Field 6) - Item number on line, for linking[27:1]- Item (Table 27): No. (Field 1) - Item number for linking and display[27:3]- Item (Table 27): Description (Field 3) - Item description in message[37:15]- Sales Line (Table 37): Quantity (Field 15) - Requested quantity[27:Inventory]- Item (Table 27): Inventory field - Current on-hand inventorySource Reference: Other Sales Lines linked via
[27:1] = [37:6][37:3]- Sales Line (Table 37): Document No. (Field 3) - Filter to exclude current order[Current:3]- System placeholder: Current record's Document No. - Used to filter out current line[37:120]- Sales Line (Table 37): Status field (Field 120) - Filter for 'Open' ordersSUM(37:15)- Aggregate function: Total quantity committed to other open orders[27:Inventory - SUM(37:15)]- Calculated expression: Available quantity after other commitments[37:15 - ([27:Inventory - SUM(37:15)])]- Calculated expression: Shortage amount[27:CustomPOQuantity]- Item (Table 27): Custom PO Quantity field - Outstanding purchase orders[27:CustomNextReceiptDate]- Item (Table 27): Custom Next Receipt Date field - Expected delivery dateCondition:
[37:15] > [27:Inventory] - SUM(37:15)- Checks if requested quantity exceeds availableSource Reference filtering: Filters
[37:3] <> [Current:3]and[37:120] is 'Open'configured in linked table setup
Result: User understands exact inventory situation and available options.
Part 3: Conditional Messages
Messages Based on Multiple Conditions
Messages can include conditional content that adapts based on data conditions.
Validation Set: Item - Price Validation - OnModify
Rule 1: Validate Price Changes
Table: Item (27)
Scenario:
Condition:
Action - Message:
Placeholders Used in This Example:
{27:27}- Item (Table 27): Unit Price (Field 27) - OLD value before modification (curly braces)[27:27]- Item (Table 27): Unit Price (Field 27) - NEW current value (square brackets)[27:1]- Item (Table 27): No. (Field 1) - Item number in message[27:3]- Item (Table 27): Description (Field 3) - Item description in message[27:22]- Item (Table 27): Unit Cost (LCY) (Field 22) - Item cost for margin calculationOld value comparison:
{27:27} is <>[27:27]- Scenario checks if price changedDecrease threshold:
[27:27] is <{27:27} * 0.8- Condition checks if decreased by more than 20%Increase threshold:
[27:27] is >{27:27} * 1.5- Condition checks if increased by more than 50%Change amount:
[27:27 - {27:27}]- Calculated difference between new and old pricePercentage change:
[[27:27 / {27:27} - 1] * 100]- Calculated percentage changeConditional direction:
IF([27:27] < {27:27}, 'PRICE DECREASE', 'PRICE INCREASE')- Dynamic label based on directionBelow cost check:
IF([27:27] < [27:22], 'WARNING...', 'New Margin...')- Conditional warning if price below costMargin calculation:
[([27:27] - [27:22]) / [27:27] * 100]- New profit margin percentageImpact message:
IF([27:27] < {27:27}, 'Price reductions...', 'Significant increases...')- Context-specific guidanceNote: Old value placeholders
{27:27}only available on Modify triggers
Result: Message adapts to show relevant warnings based on increase vs. decrease.
Change amount:
[27:27 - {27:27}]- Calculated difference between new and old pricePercentage change:
[27:27 / {27:27} - 1] * 100- Calculated percentage changeConditional direction:
IF([27:27] < {27:27}, 'PRICE DECREASE', 'PRICE INCREASE')- Dynamic label based on directionBelow cost check:
IF([27:27] < [27:22], 'WARNING...', 'New Margin...')- Conditional warning if price below costMargin calculation:
([27:27] - [27:22]) / [27:27] * 100- New profit margin percentageImpact message:
IF([27:27] < {27:27}, 'Price reductions...', 'Significant increases...')- Context-specific guidanceNote: Old value placeholders
{27:27}only available on Modify triggers
Result: Message adapts to show relevant warnings based on increase vs. decrease.
Scenario-Specific Messages
Rule 2: Vendor Selection Validation
Validation Set: Purchase Line - Vendor Item Validation - OnValidate
Source References:
Condition:
Action - Message:
Result: Message provides vendor history and recommendations.
Part 4: Messages for Data Quality
Validation of Data Completeness
Messages can enforce data quality standards by validating required information.
Validation Set: Customer - Data Completeness - OnModify
Rule 1: Validate Critical Customer Fields
Condition:
Action - Message:
Placeholders Used in This Example:
[18:2]- Customer (Table 18): Name (Field 2) - Customer name in message[18:CustomCreditRating]- Customer (Table 18): Custom Credit Rating field - Credit rating value[18:64]- Customer (Table 18): Payment Method Code (Field 64) - Payment method[18:27]- Customer (Table 18): Payment Terms Code (Field 27) - Payment terms[18:CustomSalespersonCode]- Customer (Table 18): Custom Salesperson Code field - Assigned salespersonEmpty checks:
[18:CustomCreditRating] is '',[18:64] is '', etc. - Conditions checking for empty fieldsOR logic: Multiple conditions evaluated independently, any empty field triggers message
Conditional display:
IF([18:CustomCreditRating] is '', '• Credit Rating', '')- Shows bullet point only if field emptyMessage type: Warning - Allows continuation but alerts user to data quality issues
Result: User notified of data quality issues affecting downstream processes.
Data Consistency Validation
Rule 2: Validate Related Field Consistency
Validation Set: Item - Inventory Setup Validation - OnModify
Condition:
Action - Message:
Result: User alerted to potentially problematic configuration with guidance.
Part 5: Multi-Rule Message Coordination
Prioritized Message Display
When multiple rules could trigger messages, prioritize most critical issues.
Validation Set: Sales Order - Comprehensive Validation - OnRelease
Rule 1: Critical Blocking Issues (Priority 1)
Condition:
Action - Message:
Rule 2: Credit Issues (Priority 2)
Condition:
Action - Message:
Rule 3: Warning Issues (Priority 3)
Condition:
Action - Message:
Result: Most critical issue displayed first, preventing confusion from multiple messages.
Consolidated Message Content
Rule 4: Comprehensive Order Validation
Single message incorporating multiple validation checks.
Condition:
Action - Message:
Result: Single comprehensive message consolidates multiple validation checks.
Part 6: Best Practices
Message Design Guidelines
Structure messages clearly:
Provide actionable guidance:
Use appropriate tone:
Message Type Selection
Use Error (blocking) for:
Data integrity violations
Regulatory compliance failures
Operations that would corrupt data
Actions exceeding authorization
Use Warning (non-blocking) for:
Data quality issues
Unusual but valid situations
Best practice deviations
Recommended but not required actions
Use Information for:
Process confirmations
Success notifications
Helpful tips
Procedural reminders
Testing Checklist
Before deploying message actions:
Verify message text is clear and professional
Confirm field references display correctly
Test with null/empty field values
Verify conditional message sections show appropriately
Check message formatting (line breaks, spacing)
Validate calculated values display correctly
Test blocking messages prevent operations
Confirm warning messages allow continuation
Verify messages appear at correct timing
Test with various data scenarios
Review messages from user perspective
Ensure actionable guidance is accurate
Common Patterns
Pattern 1: Validation with Guidance
Pattern 2: Progressive Disclosure
Pattern 3: Data Quality Enforcement
Summary and Key Takeaways
This guide covered custom validation messages using QUALIA Message actions in Microsoft Dynamics 365 Business Central:
Basic messages with blocking errors and non-blocking warnings
Contextual messages incorporating field values and calculated data
Conditional content adapting messages to specific scenarios
Data quality enforcement validating completeness and consistency
Multi-rule coordination prioritizing and consolidating validation checks
Best practices for clear, actionable, professional messaging
Practical applications:
Credit limit violation messages with exposure details
Inventory shortage alerts with options
Price change validation with margin calculations
Data completeness enforcement with impact explanation
Vendor selection guidance with history
Configuration consistency validation
Implementation exercise: Create a comprehensive order validation message:
Identify key validation rules (credit, inventory, pricing, terms)
Design message structure with clear sections
Include specific field values and calculations
Provide actionable corrective guidance
Test with various order scenarios
Refine messaging based on user feedback
Related topics:
Blog 017: Multi-Condition Validation (complex validation logic)
Blog 024: Aggregate Calculations (calculations in messages)
Blog 028: Confirmation Dialogs (confirmations vs. messages)
Blog 030: Understanding Scenarios (message timing and triggers)
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.
Business Central
>
Triggering Power Automate Flows from Business Rules
>
Advanced Table Linking and Cross-Record Validation
>
Aggregate Calculations Across Related Records: Summing, Counting, and Analyzing Data
>
Automated Email Notifications from Business Rules
>
Automatically Setting Field Values with Assign Actions
>
Building an Approval Workflow: When Orders Need Manager Sign-Off
>
Building Commission Calculation Rules for Sales Teams: Automating Sales Incentives
>
Building Multi-Condition Validation Rules: Understanding Independent Condition Evaluation
>
Construction and Project-Based Industry Solutions
>
Creating Your First Business Rule: A Step-by-Step Beginner's Guide
>
Custom Validation Messages for Business Rules
>
Distribution and Logistics Industry Solutions
>
Energy and Utilities Industry Solutions
>
Financial Services Industry Solutions
>
Food and Beverage Industry Solutions
>
Government and Public Sector Procurement Solutions
>
Healthcare and Medical Supply Industry Solutions
>
How to Implement Credit Limit Validation in 10 Minutes
>
How to Link Multiple Tables for Complex Multi-Table Validation
>
How to Prevent Infinite Loops in Your Business Rules
>
How to Prevent Negative Inventory with Business Rules
>
How to Validate Customer Data Before Order Creation
>
Implementing Discount Authorization Rules: Control Pricing with Confidence
>
Implementing Required Field Validation: Ensuring Data Completeness
>
Interactive Confirmation Dialogs in Business Rules
>
Manufacturing Industry Solutions
>
Non-Profit and Grant Management Solutions
>
Performance Optimization for Business Rules
>
Pharmaceuticals and Life Sciences Solutions
>
Preventing Data Entry Errors: Validation Best Practices
>
Professional Services Industry Solutions
>
Real Estate and Property Management Solutions
>
Retail and Point-of-Sale Industry Solutions
>
Rule Groups and User Permissions: Controlling Who Gets Which Rules
>
Rule Set Organization and Maintenance
>
Rule Versioning and Change Management
>
Testing and Debugging QUALIA Business Rules
>
Transportation and Logistics Industry Solutions
>
Understanding the Rule Execution Pipeline: From Trigger to Action
>
Understanding Validation Scenarios and Timing
>
Using Old Value Placeholders for Change Detection and Validation
Related Posts
Understanding the Rule Execution Pipeline: From Trigger to Action
QUALIA Rule Engine operates as a sophisticated event-driven system that intercepts data changes in Business Central and evaluates configured business rules in real-time. Understanding the execution pipeline—how a database operation flows through trigger detection, scenario evaluation, condition processing, and action execution—is essential for advanced rule design, performance optimization, and troubleshooting.
Energy and Utilities Industry Solutions
Energy and utilities companies face complex regulatory requirements including FERC compliance, NERC reliability standards, environmental regulations, rate case filings, renewable energy credit tracking, interconnection agreements, demand response programs, and outage management protocols. Asset-intensive operations with critical infrastructure, regulatory cost recovery mechanisms, time-of-use pricing structures, and customer meter-to-cash processes demand automated validation beyond standard ERP capabilities.
Real Estate and Property Management Solutions
Real estate and property management companies require specialized business rules for lease administration, tenant billing, common area maintenance (CAM) reconciliation, security deposit tracking, maintenance workflow management, vacancy management, rent escalation calculations, and portfolio performance analysis. Multi-entity property ownership structures, percentage rent calculations, operating expense recoveries, lease abstraction accuracy, and compliance with lease accounting standards (ASC 842 / IFRS 16) demand automated validation beyond standard ERP capabilities.
Get Your FREE Dynamics 365 Demo
Transform your business operations with Microsoft Dynamics 365 Business Central
Experience the transformative power of Microsoft Dynamics 365 Business Central for yourself! Request a free demo today and see how our solutions can streamline your operations and drive growth for your business.
Our team will guide you through a personalized demonstration tailored to your specific needs. This draft provides a structured approach to presenting Qualia Tech's offerings related to Microsoft Dynamics 365 Business Central while ensuring that potential customers understand the value proposition clearly.