Tutorial: Your First Business Rule

This tutorial guides you through the complete process of creating your first business rule in QUALIA Rule Engine. You will learn the fundamental steps required to create, configure, test, and deploy a working business rule that validates data entry in Business Central. By following this tutorial from start to finish, you will gain hands-on experience with the core features of QUALIA Rule Engine and develop an understanding of how business rules are structured, how they execute, and how they interact with Business Central's data entry processes.

The tutorial uses a practical, real-world scenario that many organizations need to implement: preventing users from entering sales order lines with zero or negative quantities. This is a common data quality issue that can cause problems in downstream processes such as inventory management, shipping, and invoicing. By the end of this tutorial, you will have created a fully functional business rule that automatically validates quantity values whenever users create or modify sales order lines, providing immediate feedback when invalid values are entered and preventing those invalid values from being saved to the database.

5.1 Tutorial Overview and Learning Objectives

What You Will Learn

This tutorial covers the complete lifecycle of creating a business rule, from initial planning through testing and deployment. By completing this tutorial, you will learn how to:

  • Analyze a business requirement and determine the appropriate Business Central table to trigger on

  • Create a new Business Rule Set (Validation Set) with proper identification and configuration

  • Configure trigger settings that determine when your rule executes

  • Build validation formulas using placeholder syntax to reference field values

  • Configure error actions that prevent invalid data from being saved

  • Test your rule in a safe environment to verify it works correctly

  • Use the Validation Log to understand rule execution and troubleshoot issues

  • Enable your rule for production use after successful testing

Prerequisites Before You Begin

Before starting this tutorial, verify that you have completed the following prerequisites:

System Access: You must have access to a Microsoft Dynamics 365 Business Central environment where QUALIA Rule Engine version 1.1.0.4 or later is installed and enabled. If you are not sure whether QUALIA Rule Engine is installed, search for "Business Rules" in Business Central. If the Business Rules page opens successfully, the extension is installed.

Permissions: Your user account must be assigned appropriate permission sets that allow you to create and modify business rules. At minimum, you need the "QUA Business Rules UnLicensed" permission set. To verify your permissions, try creating a new Business Rule Set by opening the Business Rules page and selecting New. If Business Central opens the Business Rule Card in create mode, you have sufficient permissions.

Test Environment: Microsoft strongly recommends that you complete this tutorial in a sandbox environment or test company, not in your production environment. Sandbox environments allow you to experiment with configuration changes without risk of disrupting live business operations. If you do not have access to a sandbox environment, work in a test company that is not used for actual business transactions.

Basic Business Central Knowledge: This tutorial assumes you are familiar with basic Business Central navigation, including how to use the search function to find pages, how to create and edit records, and how to enter data in Business Central forms. You should understand what sales orders are and how users create them in Business Central.

Business Requirement to Implement

For this tutorial, you will implement the following business requirement:

"Users must not be able to enter sales order lines with zero or negative quantities. When a user attempts to create a sales line with Quantity = 0 or Quantity < 0, the system must display a clear error message explaining that quantities must be positive, and the system must prevent the invalid line from being saved."

This requirement is typical of data validation rules that organizations implement to maintain data quality and prevent downstream processing errors.

5.2 Step 1: Planning Your Business Rule

Before you begin creating your business rule in QUALIA Rule Engine, it is important to analyze the business requirement and plan your implementation approach. Proper planning helps ensure that you configure the rule correctly and avoid common mistakes that can lead to rules that do not work as intended or that cause unintended side effects.

Identifying the Trigger Table

The first decision you need to make is which Business Central table should trigger your rule. The trigger table determines when your rule executes—specifically, your rule will execute when users create, modify, or delete records in the trigger table.

For the requirement "prevent sales order lines with zero or negative quantities," the relevant data is entered in the Sales Line table. When users create or modify sales order lines in Business Central, they are working with records in table 37 (Sales Line). This table contains the Quantity field that you need to validate. Therefore, the correct trigger table for this rule is:

Trigger Table: 37 (Sales Line)

Determining Which Trigger Types to Use

Business Central supports three trigger types that determine which database operations activate your rules:

  • Before Insert: Executes when a new record is being created, after the user has entered data but before the record is saved to the database

  • Before Modify: Executes when an existing record is being changed, after the user has modified field values but before the changes are saved

  • Before Delete: Executes when a record is being deleted, before the record is actually removed from the database

For the quantity validation requirement, you need to prevent invalid quantities both when users create new sales lines and when users modify existing sales lines. Therefore, you should activate both the Before Insert and Before Modify triggers. You do not need the Before Delete trigger because deleting a sales line does not involve validating the quantity value.

Summary of trigger configuration:

  • Trigger Insert: Yes - Validate quantity when new sales lines are created

  • Trigger Modify: Yes - Validate quantity when existing sales lines are modified

  • Trigger Delete: No - Not relevant for quantity validation

Identifying the Field to Validate

The business requirement specifically mentions validating the Quantity field on sales lines. In Business Central's Sales Line table (Table 37), the Quantity field is Field 15. You will use the placeholder notation [37:15] to reference this field in your validation formula.

Defining the Validation Logic

The requirement states that quantities must not be zero or negative. This means the validation should fail (display an error) when the Quantity value is less than or equal to zero. In QUALIA Rule Engine's formula syntax, this validation is expressed as:

[37:15] is <=0

This formula reads as: "Sales Line Quantity is less than or equal to zero." When this condition evaluates to TRUE (meaning an invalid quantity was entered), the rule should execute an error action that displays a message and prevents the transaction.

Planning the Error Message

When the validation fails, users need to understand what is wrong and how to fix it. An effective error message should:

  • Clearly state what the problem is

  • Explain why the value is invalid

  • Provide guidance on what value is acceptable

For this requirement, an appropriate error message might be:

"Quantity must be a positive number. You entered a quantity of zero or a negative value, which is not allowed. Please enter a quantity greater than zero."

Implementation Checklist

Before proceeding to create the rule in Business Central, verify your planning decisions:

☑️ Trigger Table: Table 37 (Sales Line)
☑️ Trigger Insert: Enabled (validate new lines)
☑️ Trigger Modify: Enabled (validate modifications)
☑️ Trigger Delete: Disabled (not needed)
☑️ Field to Validate: Field 15 (Quantity)
☑️ Validation Formula: [37:15] is <=0
☑️ Action Type: Error Message (block transaction)
☑️ Error Message Text: Clear explanation of the problem and expected value

With this plan in place, you are ready to create the business rule in QUALIA Rule Engine.

5.3 Step 2: Creating the Business Rule Set

Now that you have planned your business rule implementation, you can create the Business Rule Set (also called a Validation Set) that will contain your rule. A Business Rule Set is a container that groups related rules together and defines the trigger table and trigger types that apply to all rules within the set.

Opening the Business Rules Page

To begin creating your Business Rule Set, you need to open the Business Rules list page in Business Central:

  1. Click in the search box at the top of the Business Central interface or press Alt+Q to activate the Tell Me feature

  2. Type "Business Rules" in the search box

  3. As you type, Business Central displays matching pages in the search results dropdown

  4. Select Business Rules from the search results

Business Central opens the Business Rules list page, which displays all existing Business Rule Sets in your environment. If this is the first time anyone has created business rules in your environment, the list may be empty.

Creating a New Business Rule Set

From the Business Rules list page, you will create a new, blank Business Rule Set:

  1. Locate the action bar at the top of the Business Rules list page

  2. Select the New button in the action bar (you can also press Alt+N as a keyboard shortcut)

  3. Business Central opens the Business Rule Card page in create mode, displaying a blank form ready for you to configure

The Business Rule Card page is organized into multiple tabs. You will start by configuring the General tab, which contains the fundamental properties that identify the Business Rule Set and control when it executes.

Configuring the Business Rule Set Code

The first field you need to configure is the Code field, which provides a unique identifier for this Business Rule Set:

  1. Locate the Code field in the General tab

  2. Enter a meaningful code that follows your organization's naming conventions. For this tutorial, use the code: SALES-QTYVAL

  3. The code should be descriptive enough that you can identify the purpose of the rule set when you see it in list views

💡 TIP: Many organizations use prefixes in their Business Rule Set codes to indicate the functional area or module. For example, "SALES-" for sales-related rules, "PURCH-" for purchasing rules, "INV-" for inventory rules. This naming convention makes it easier to locate and organize rules as your library of business rules grows.

Configuring the Business Rule Set Name

The Name field provides a short, descriptive name that appears in list views and reports:

  1. Locate the Name field immediately below the Code field

  2. Enter a clear name that describes the purpose of this rule set. For this tutorial, use: Sales Line Quantity Validation

The name should be concise but descriptive enough that users can understand the general purpose without needing to read the detailed description.

Configuring the Business Rule Set Description

The Description field allows you to provide detailed information about what this Business Rule Set does, why it exists, and what business requirements it enforces:

  1. Locate the Description field below the Name field

  2. Enter a comprehensive description that explains the purpose and scope. For this tutorial, use:

"Prevents users from entering sales order lines with zero or negative quantities. Validates the Quantity field on both new sales lines (Insert) and modified sales lines (Modify). Displays an error message when invalid quantities are detected and prevents the transaction from being saved."

A detailed description is valuable for documentation purposes and helps other users understand the purpose of the rule set when they review business rules months or years after the initial creation.

Configuring the Enable Checkbox

The Enable checkbox in the General tab controls whether this Business Rule Set is currently active:

  1. Locate the Enable checkbox in the General tab

  2. Leave the checkbox unchecked for now

When you are creating a new business rule, Microsoft best practice is to leave the rule set disabled until you have completed the configuration and thoroughly tested it. This prevents the rule from executing unexpectedly while you are still building it. You will enable the rule set later in the tutorial after you have verified that it works correctly.

Setting the Trigger Table

The Trigger Table field determines which Business Central table this rule set applies to:

  1. Locate the Trigger Table field in the General tab

  2. Click in the field or select the dropdown arrow to open the table lookup

  3. In the lookup window, you can search for tables by either table number or table name

  4. For this tutorial, enter 37 or search for "Sales Line"

  5. Select 37 Sales Line from the lookup results

Once you have selected the trigger table, all Business Rules within this Business Rule Set will trigger on the Sales Line table. This setting cannot be changed after you create the Business Rule Set, so it is important to select the correct table.

Configuring Trigger Types

The Trigger Type checkboxes determine which database operations will cause this Business Rule Set to execute:

  1. Locate the trigger type checkboxes in the General tab. You should see three checkboxes:

    • Trigger Insert

    • Trigger Modify

    • Trigger Delete

  2. Select the Trigger Insert checkbox to enable validation when new sales lines are created

  3. Select the Trigger Modify checkbox to enable validation when existing sales lines are modified

  4. Leave the Trigger Delete checkbox unchecked because quantity validation is not relevant when deleting records

By selecting both Insert and Modify triggers, you ensure that your validation rule executes regardless of whether users are creating new sales lines or modifying existing ones.

Saving the Business Rule Set

Now that you have configured all the basic properties of your Business Rule Set, you should save it:

  1. Select the OK button at the bottom of the Business Rule Card page, or press Ctrl+Enter to save and close

  2. Business Central saves the new Business Rule Set and returns you to the Business Rules list page

  3. Locate your new Business Rule Set in the list (Code: SALES-QTYVAL). Verify that the Enable column shows unchecked and the Trigger Table column shows "37 Sales Line"

At this point, you have successfully created the Business Rule Set container, but you have not yet defined any actual business rules (validation lines) within it. The next steps will involve adding the validation formula and error action.

5.4 Step 3: Adding the Validation Rule

Now that you have created the Business Rule Set container, you need to add the actual business rule that defines the validation logic and specifies what action should be taken when invalid data is detected. In QUALIA Rule Engine terminology, individual business rules within a Business Rule Set are called "validation lines" or simply "rules."

Opening the Business Rule Set for Editing

To add validation rules to your Business Rule Set, you need to open it for editing:

  1. From the Business Rules list page, locate your Business Rule Set (Code: SALES-QTYVAL)

  2. Double-click the row, or select the row and then click Edit in the action bar

  3. Business Central opens the Business Rule Card page showing your Business Rule Set configuration

Navigating to the Rules Tab

The Business Rule Card page is organized into multiple tabs. The validation rules are configured in the Rules tab:

  1. Locate the tab strip near the top of the Business Rule Card page

  2. Select the Rules tab

The Rules tab displays two sections: Scenarios and Conditions. For this tutorial, you will create a Condition (the actual validation rule) without using Scenarios. Scenarios are optional pre-conditions that filter which records should be evaluated—for quantity validation, you want to validate all sales lines, so no scenario filtering is needed.

Creating a New Validation Rule

From the Rules tab, you will create a new validation rule in the Conditions section:

  1. Locate the Conditions section in the Rules tab

  2. If the Conditions section is empty (showing no existing rules), click anywhere in the Conditions section to activate it

  3. Business Central may prompt you to add a new line. Select Yes or press Enter to create a new validation rule

Alternatively, if there is a New button or Insert Line action available in the Conditions section, select that to create a new rule.

  1. Business Central opens the Quick Rule Card page, which is a simplified interface for configuring a single validation rule

The Quick Rule Card page is designed to display all components of one rule in a single, focused view. This makes it easier to understand how the different parts of a rule relate to each other.

Configuring the Rule's Trigger Field

The Quick Rule Card page displays a General section at the top, which contains trigger configuration for this specific rule:

  1. Locate the Trigger Field field in the General section

  2. This field specifies which field changes should activate this specific rule. For quantity validation, you want the rule to execute whenever the Quantity field is created or modified

  3. Enter the placeholder notation: [37:15]

This placeholder refers to Field 15 (Quantity) in Table 37 (Sales Line). By specifying this trigger field, you are telling QUALIA Rule Engine to execute this rule whenever the Quantity field is involved in the insert or modify operation.

💡 TIP: You can use the field lookup feature to insert placeholders without needing to memorize table and field numbers. Press F6 while the cursor is in the Trigger Field, and Business Central displays a lookup window where you can search for tables and fields by name. This prevents typos and ensures you are using correct table and field IDs.

Understanding the Trigger Description

After you enter the Trigger Field, QUALIA Rule Engine automatically generates a human-readable description of the trigger configuration:

  1. Locate the Trigger Description field below the Trigger Field

  2. This field displays an auto-generated description such as: "Sales Line - Quantity (Field 37:15) - Insert, Modify"

  3. You cannot edit this field directly—it updates automatically based on your Trigger Field and Trigger Type selections

The Trigger Description helps you verify that your trigger configuration is correct by displaying it in plain English.

Configuring the Validation Formula

Now you will create the validation formula that defines what data pattern to check for. The validation formula goes in the Validations section of the Quick Rule Card:

  1. Locate the Validations section in the middle of the Quick Rule Card page

  2. Within the Validations section, you should see columns for defining your validation logic. Look for the Validate Field or Validation Formula column

  3. In this column, enter the placeholder that represents the field you want to validate: [37:15]

  4. Next, you need to specify the comparison operator and value. Look for the Validation String or Comparison column

  5. In this column, enter: is <=0

The complete validation formula is: [37:15] is <=0

This formula evaluates to TRUE when the Quantity field contains a value that is less than or equal to zero. When the formula evaluates to TRUE, it means invalid data has been detected, and the actions you attach to this condition will execute.

Understanding Validation Formula Syntax

QUALIA Rule Engine uses a specific syntax for validation formulas:

  • Placeholders are enclosed in square brackets: [TableID:FieldID]

  • Comparison operators use keywords like is, not symbols like =

  • The is keyword means "is equal to" when followed by a single value

  • Comparison operators can be combined: is <= means "is less than or equal to"

  • Numeric values are entered without quotes: 0, 100, -5

The validation formula is case-insensitive, but field placeholders must use the correct table and field IDs.

Adding a Description to Your Validation Rule

Good documentation practice is to add a description that explains what the validation rule checks:

  1. Look for a Description field in the Validations section

  2. Enter a clear description of what this rule validates. For this tutorial, use:

"Quantity must be greater than zero - Prevent zero or negative quantities"

This description will appear in reports and the Validation Log, making it easier to understand what the rule does when reviewing execution history or troubleshooting issues.

5.5 Step 4: Configuring the Error Action

At this point, you have created a validation formula that evaluates to TRUE when an invalid quantity (zero or negative) is detected. Now you need to specify what should happen when this invalid data is detected. In QUALIA Rule Engine, you do this by attaching an Action to your validation condition.

For this tutorial, you will attach an Error Message action, which displays an error message to the user and prevents the invalid transaction from being saved to the database.

Locating the Actions Section

The Quick Rule Card page includes an Actions section that displays actions attached to the currently selected validation condition:

  1. Locate the Actions section, typically positioned below the Validations section

  2. The Actions section displays any actions that are configured for the validation condition you just created

  3. If this is a new rule, the Actions section will be empty

Creating a New Error Action

To add an error action to your validation rule:

  1. Click anywhere in the Actions section to activate it

  2. Business Central may prompt you to add a new action line. Select Yes or press Enter to create a new action

  3. Alternatively, if there is a New or Add Action button visible, select that to create a new action

  4. Business Central adds a new action line with default values

Configuring the Action Type

Each action has an Action Type that determines what the action does. QUALIA Rule Engine supports 11 action types (enum values 0-10), but for this tutorial you need an Error Message action:

  1. Locate the Action Type field or column in the Actions section

  2. Click in the field to open the dropdown list of available action types

  3. Select Error Message from the list (this is action type 1)

When you select Error Message as the action type, QUALIA Rule Engine knows that this action should display an error message and block the transaction when the condition evaluates to TRUE.

Configuring the Error Message Text

Now you need to specify what error message should be displayed to users when the invalid quantity is detected:

  1. Locate the Action Code or Message field in the Actions section (the exact field name may vary, but it is the field where you specify the error message text)

  2. If this is a detail field that opens a separate card page, select the field to open the error message details

  3. In the error message configuration, locate the Message or Text field where you can enter the actual error message that users will see

  4. Enter a clear, helpful error message that explains what is wrong and how to fix it. For this tutorial, use:

"Quantity must be a positive number. Please enter a quantity greater than zero."

💡 TIP: Effective error messages should be:

  • Clear - State exactly what is wrong in simple language

  • Specific - Reference the specific field or value that is invalid

  • Actionable - Tell users what they need to do to fix the problem

  • Professional - Use complete sentences with proper grammar and punctuation

Avoid technical jargon or vague messages like "Invalid value" or "Error in field" which do not help users understand what they did wrong or how to correct it.

Understanding Error Action Behavior

It is important to understand what happens when an Error Message action executes:

  1. Transaction Rollback: The entire database transaction is rolled back, which means that no data is saved. The insert or modify operation is cancelled completely.

  2. User Feedback: Business Central displays the error message in a modal dialog box. Users must acknowledge the error by clicking OK before they can continue.

  3. Data Retention: The values users entered remain visible on the screen so users can correct the invalid value and try again. Users do not lose their work—they just cannot save until they fix the problem.

  4. Execution Stop: When an Error action executes, QUALIA Rule Engine stops processing immediately. No subsequent actions in the same condition execute, and no other conditions in the rule set are evaluated.

This behavior is exactly what you want for data validation: prevent invalid data from being saved while giving users the opportunity to correct their mistake.

Saving the Validation Rule

Now that you have configured both the validation formula and the error action, you should save the validation rule:

  1. Locate the OK button or Close button at the bottom of the Quick Rule Card page

  2. Select the button to save your changes and close the Quick Rule Card

  3. Business Central saves the validation rule and returns you to the Business Rule Card page's Rules tab

  4. In the Rules tab, you should now see your validation rule displayed in the Conditions section, with a description that references Field 37:15 (Quantity)

Your validation rule is now complete and ready for testing. However, remember that the Business Rule Set itself is still disabled (the Enable checkbox is not selected), so the rule will not execute yet. You will enable it in the testing step after verifying that it is configured correctly.

5.6 Step 5: Testing Your Business Rule

Before enabling your business rule for production use, it is critical to test it thoroughly in a safe environment to verify that it works as intended and does not have unintended side effects. This section guides you through the testing process.

Verifying Your Configuration Before Testing

Before you begin testing, take a moment to verify that all components of your business rule are configured correctly:

  1. From the Business Rule Card page, verify the General tab settings:

    • Code: SALES-QTYVAL

    • Name: Sales Line Quantity Validation

    • Trigger Table: 37 Sales Line

    • Trigger Insert: Checked

    • Trigger Modify: Checked

    • Trigger Delete: Unchecked

    • Enable: Unchecked (you will enable it next)

  2. Verify the Rules tab contains your validation rule:

    • Trigger Field: [37:15]

    • Validation Formula: [37:15] is <=0

    • Action Type: Error Message

    • Error Message: "Quantity must be a positive number. Please enter a quantity greater than zero."

If any of these settings are incorrect, correct them now before proceeding with testing.

Enabling the Business Rule Set for Testing

To test your rule, you need to enable it temporarily:

  1. From the Business Rule Card page, select the General tab

  2. Locate the Enable checkbox

  3. Select the checkbox to activate the Business Rule Set

  4. Select OK or press Ctrl+Enter to save the change

Your business rule is now active and will execute whenever users create or modify sales lines. Because you are testing in a sandbox environment or test company, it is safe to enable the rule for testing purposes.

Test Case 1: Creating a Sales Line with Invalid Quantity (Zero)

The first test case verifies that the rule prevents users from creating new sales lines with a quantity of zero:

  1. Navigate away from the Business Rules configuration and search for "Sales Orders" in Business Central

  2. Open an existing sales order, or create a new sales order if none exist

  3. In the sales lines section, create a new line:

    • Enter a valid Type (for example, Item)

    • Enter a valid No. (select any item from the lookup)

    • In the Quantity field, enter 0 (zero)

  4. Press Tab or click outside the Quantity field to trigger the validation

  5. Business Central should display your error message: "Quantity must be a positive number. Please enter a quantity greater than zero."

  6. Select OK to acknowledge the error message

  7. Verify that the sales line was not saved—you should still be in edit mode for the line, and the line should not appear in the saved lines list

Expected Result: The error message displays, and the line is not saved. ✅

Test Case 2: Creating a Sales Line with Invalid Quantity (Negative)

The second test case verifies that the rule also prevents negative quantities:

  1. Still in the same sales order, attempt to create another new line

  2. Enter valid values for Type and No.

  3. In the Quantity field, enter -5 (negative five)

  4. Press Tab to trigger the validation

  5. You should again see the error message about quantity needing to be a positive number

  6. Verify that the line was not saved

Expected Result: The error message displays, and the line is not saved. ✅

Test Case 3: Creating a Sales Line with Valid Quantity

The third test case verifies that the rule allows valid quantities to be saved normally:

  1. Still in the same sales order, create another new line

  2. Enter valid values for Type and No.

  3. In the Quantity field, enter 10 (a positive number)

  4. Press Tab to move to the next field

  5. No error message should appear

  6. Complete the line and verify that it saves successfully

Expected Result: No error message displays, and the line saves normally. ✅

Test Case 4: Modifying an Existing Line to Invalid Quantity

The fourth test case verifies that the rule also prevents modifications that change valid quantities to invalid ones:

  1. Locate the sales line you just created (with Quantity = 10)

  2. Click in the Quantity field to edit it

  3. Change the quantity from 10 to 0

  4. Press Tab to leave the field

  5. You should see the error message

  6. Press Escape or change the value back to a valid number to cancel the invalid modification

Expected Result: The error message displays when trying to change to an invalid quantity. ✅

Reviewing the Validation Log

After completing your test cases, you should review the Validation Log to see a history of when your rule executed and what the results were:

  1. Search for "Validation Log" in Business Central

  2. Open the Validation Log page

  3. Locate entries related to your test transactions (look for entries with Trigger Table = 37 Sales Line)

  4. Review the log entries to see:

    • When each rule execution occurred (date and time)

    • Which user triggered the rule (your user name)

    • What the validation result was (TRUE for invalid quantity detected)

    • Whether an action executed (Error Message action)

The Validation Log provides a complete audit trail of business rule execution, which is valuable for troubleshooting, compliance reporting, and understanding how rules are being used in your environment.

Disabling the Rule After Testing (Optional)

If you completed testing and verified that everything works correctly, you have two options:

Option 1: Leave the rule enabled - If you are ready to deploy the rule to production (or if you are already testing in a production environment), leave the Enable checkbox selected. The rule is now protecting your data quality.

Option 2: Disable the rule temporarily - If you need to make adjustments or if you completed testing in a sandbox and are not yet ready to deploy to production, you can disable the rule:

  1. Return to the Business Rules page

  2. Locate your Business Rule Set (SALES-QTYVAL)

  3. Select Edit to open it

  4. Clear the Enable checkbox

  5. Save the changes

Disabling the rule prevents it from executing while preserving all your configuration, so you can re-enable it later when you are ready.

5.7 Understanding What Happened: Behind the Scenes

Now that you have successfully created and tested your first business rule, it is valuable to understand what happens behind the scenes when your rule executes. This understanding will help you create more sophisticated rules in the future and troubleshoot issues when rules do not behave as expected.

The Complete Execution Flow

When you entered a zero quantity in your test and pressed Tab, the following sequence of events occurred:

Step 1: User Action You entered a value of 0 in the Quantity field and moved focus to another field. This action triggered Business Central to attempt to save the sales line record to the database.

Step 2: Trigger Interception Before saving the record, Business Central's GlobalTriggerManagement framework intercepted the database insert operation. QUALIA Rule Engine has registered to receive notifications about Before Insert events on the Sales Line table, so Business Central paused the transaction and notified QUALIA Rule Engine that a sales line insert is about to occur.

Step 3: Rule Set Discovery QUALIA Rule Engine searched for all active Business Rule Sets that match the current context:

  • Trigger Table = 37 (Sales Line)

  • Trigger Type = Before Insert

  • Enable = TRUE (activated)

  • User has access (either through Rule Groups or ALL group assignment)

Your SALES-QTYVAL Business Rule Set matched all these criteria, so QUALIA Rule Engine loaded it for evaluation.

Step 4: Scenario Evaluation QUALIA Rule Engine checked whether the Business Rule Set has any Scenarios (pre-conditions). Your rule set has no scenarios, so this step was skipped. All validation conditions will be evaluated.

Step 5: Condition Evaluation QUALIA Rule Engine evaluated your validation formula:

  • Read the value of Field 15 (Quantity) from the pending Sales Line record: value = 0

  • Evaluated the formula: [37:15] is <=00 <= 0TRUE

  • The condition evaluated to TRUE, which means the validation detected a problem

Step 6: Action Execution Because the condition evaluated to TRUE, QUALIA Rule Engine executed the action attached to the condition:

  • Action Type = Error Message

  • Retrieved the error message text: "Quantity must be a positive number. Please enter a quantity greater than zero."

  • Raised an error in Business Central, which displays the message in a modal dialog and rolls back the transaction

Step 7: Transaction Rollback Business Central rolled back the entire database transaction. The sales line record was not saved, the database remains unchanged, and the user's screen still shows the invalid data so the user can correct it.

Step 8: Validation Logging QUALIA Rule Engine wrote an entry to the Validation Log recording:

  • When the rule executed (date and time)

  • Which user triggered it (your user account)

  • What the trigger table was (Sales Line)

  • What the validation result was (TRUE - invalid data detected)

  • Which action executed (Error Message)

Why the Rule Fires on Both Insert and Modify

You configured your Business Rule Set with both Trigger Insert and Trigger Modify enabled. This means the exact same validation logic executes in two different scenarios:

Insert Scenario: When creating a new sales line, before the record is saved for the first time Modify Scenario: When changing an existing sales line, before the changes are saved

The validation formula [37:15] is <=0 works the same way in both scenarios—it checks the Quantity value that is about to be saved and displays an error if that value is invalid.

How Placeholder Values Are Resolved

When QUALIA Rule Engine evaluated the formula [37:15] is <=0, it needed to know what value to use for the placeholder [37:15]:

  • The placeholder notation [37:15] means "Field 15 in Table 37"

  • QUALIA Rule Engine is currently processing a trigger on Table 37 (Sales Line)

  • QUALIA Rule Engine reads the value of Field 15 (Quantity) from the record that is being inserted or modified

  • This is the new value that the user just entered, not the old value that exists in the database

  • The formula compares this new value against 0 to determine whether it is valid

Why Using Trigger Field [37:15] Improves Performance

You configured the Trigger Field as [37:15], which means "this rule only applies when the Quantity field is being created or modified." This configuration provides an important performance optimization:

Without Trigger Field Specification: QUALIA Rule Engine would execute this rule for every sales line insert or modify, regardless of which field changed. If a user modified the Description field on an existing sales line, your rule would still execute even though the Quantity did not change.

With Trigger Field [37:15]: QUALIA Rule Engine only executes this rule when the Quantity field is involved in the operation. If a user modifies only the Description field, your rule is skipped entirely because the Quantity field did not change.

This optimization becomes more important as you create more business rules, because it reduces unnecessary rule evaluations and improves overall system performance.

5.8 Next Steps and Learning Path

Congratulations! You have successfully created, tested, and deployed your first business rule in QUALIA Rule Engine. You now understand the fundamental process of creating validation rules that enforce data quality standards in Business Central.

Skills You Have Learned

By completing this tutorial, you have gained practical experience with the following QUALIA Rule Engine capabilities:

  • Creating Business Rule Sets and configuring trigger tables and trigger types

  • Using placeholder notation to reference field values in validation formulas

  • Writing validation formulas using comparison operators

  • Attaching Error Message actions to validation conditions

  • Testing business rules in a safe environment

  • Using the Validation Log to review rule execution history

  • Understanding the complete execution lifecycle of business rules

Expanding Your Knowledge

Now that you understand the basics, you can expand your business rule capabilities by exploring more advanced features:

Learn About Other Action Types (Sections 7-17): Your first rule used an Error Message action to block invalid data. QUALIA Rule Engine supports 10 additional action types including:

  • Message - Display informational messages without blocking transactions

  • Confirmation - Prompt users for Yes/No decisions with conditional logic

  • Notification - Show non-blocking banner notifications

  • Send Email - Automatically email stakeholders when events occur

  • Assign - Automatically populate field values based on conditions

  • Insert - Create new records automatically

  • URL - Open websites or applications

  • Custom Action - Execute custom AL codeunit procedures

  • Power Automate - Trigger Microsoft Power Automate flows

Learn About Scenarios (Section 4.1): Scenarios are optional pre-conditions that filter which records should be evaluated by your conditions. Using scenarios effectively can dramatically improve rule performance and make complex rules easier to understand.

Learn About Linked Tables (Section 18): Linked Tables allow your rules to access data from tables other than the trigger table. This is essential for creating rules that validate data across related tables, such as checking customer credit limits when validating sales orders.

Learn About Rule Groups (Section 20): Rule Groups allow you to assign specific business rules to specific users or teams. This enables you to implement department-specific rules or role-based validations.

Practice Creating More Rules

The best way to become proficient with QUALIA Rule Engine is to practice creating rules that solve real business problems in your organization. Consider implementing these common validation scenarios as practice exercises:

  1. Discount Limit Validation: Prevent users from entering discounts higher than 20% without manager approval

  2. Credit Limit Checking: Display a warning when a sales order would cause a customer to exceed their credit limit

  3. Required Field Validation: Require specific fields to be populated before allowing records to be saved

  4. Cross-Field Validation: Validate that related field values are consistent (for example, Unit Price × Quantity should equal Line Amount)

Join the QUALIA Rule Engine Community

If you have questions, want to share your experiences, or need help with specific scenarios:

  • Contact QUALIA Technik GmbH support: info@qualiatechnik.de

  • Visit the QUALIA Technik website for knowledge base articles and best practices guidance

  • Consult the other sections of this user manual for detailed documentation of specific features

Richten Sie Ihre Testversion von Business Central ein.

mit QUALIA Technik GmbH

Starten Sie Ihre 30-tägige Testphase (bei Bedarf auf 60–90 Tage verlängerbar) mit Expertenhilfe, Beispieldaten oder Ihren eigenen Daten.

Was Sie in Ihrer kostenlosen Business Central-Testversion erhalten

  • 25 Testbenutzer, in wenigen Minuten einsatzbereit
    Wir stellen Ihnen eine CSP Premium-Testversion mit 25 Lizenzen für 30 Tage zur Verfügung – während der Testphase fallen keine Kosten an, und Sie können jederzeit wechseln.

  • Oder wählen Sie den öffentlichen Testpfad (bis zu 90 Tage).
    Starten Sie eine Microsoft „öffentliche/virale“ Testversion mit Ihrer geschäftlichen E-Mail-Adresse, verlängern Sie diese einmal selbst (+30 Tage) und einmal über einen Partner (+30 Tage) für bis zu 90 Tage, bevor Sie ein Abonnement abschließen.

  • Geführtes Onboarding – direkt im Produkt integriert:
    Sie erhalten In- ‑App- Touren, Schulungstipps und eine „Erste Schritte“-Checkliste, sobald Sie sich anmelden, damit Ihr Team Finanzen, Vertrieb, Lagerbestand und mehr souverän erkunden kann.

  • Ihre Daten oder Beispieldaten – Sie haben die Wahl.
    Starten Sie mit einem umfangreichen Demo-Unternehmen oder importieren Sie Starterdateien; Sie können während der Testphase auch Premium- Funktionen für komplexere Szenarien aktivieren.

  • Sichere ‑Partnerunterstützung mit minimalen Berechtigungen (GDAP)
    Wir helfen Ihnen bei der Einrichtung und dem Support Ihrer Testphase mithilfe von granularer delegierter Administration (GDAP).

  • Lokalisiert für Ihren Markt:
    Die Testversionen werden mit den Sprachen und der regulatorischen Lokalisierung für Ihr Land/Ihre Region bereitgestellt.

Bitte lesen und bestätigen Sie Folgendes:

*Note: Fields marked with * are mandatory for processing your request.

Richten Sie Ihre Testversion von Business Central ein.

mit QUALIA Technik GmbH

Starten Sie Ihre 30-tägige Testphase (bei Bedarf auf 60–90 Tage verlängerbar) mit Expertenhilfe, Beispieldaten oder Ihren eigenen Daten.

Was Sie in Ihrer kostenlosen Business Central-Testversion erhalten

  • 25 Testbenutzer, in wenigen Minuten einsatzbereit
    Wir stellen Ihnen eine CSP Premium-Testversion mit 25 Lizenzen für 30 Tage zur Verfügung – während der Testphase fallen keine Kosten an, und Sie können jederzeit wechseln.

  • Oder wählen Sie den öffentlichen Testpfad (bis zu 90 Tage).
    Starten Sie eine Microsoft „öffentliche/virale“ Testversion mit Ihrer geschäftlichen E-Mail-Adresse, verlängern Sie diese einmal selbst (+30 Tage) und einmal über einen Partner (+30 Tage) für bis zu 90 Tage, bevor Sie ein Abonnement abschließen.

  • Geführtes Onboarding – direkt im Produkt integriert:
    Sie erhalten In- ‑App- Touren, Schulungstipps und eine „Erste Schritte“-Checkliste, sobald Sie sich anmelden, damit Ihr Team Finanzen, Vertrieb, Lagerbestand und mehr souverän erkunden kann.

  • Ihre Daten oder Beispieldaten – Sie haben die Wahl.
    Starten Sie mit einem umfangreichen Demo-Unternehmen oder importieren Sie Starterdateien; Sie können während der Testphase auch Premium- Funktionen für komplexere Szenarien aktivieren.

  • Sichere ‑Partnerunterstützung mit minimalen Berechtigungen (GDAP)
    Wir helfen Ihnen bei der Einrichtung und dem Support Ihrer Testphase mithilfe von granularer delegierter Administration (GDAP).

  • Lokalisiert für Ihren Markt:
    Die Testversionen werden mit den Sprachen und der regulatorischen Lokalisierung für Ihr Land/Ihre Region bereitgestellt.

Bitte lesen und bestätigen Sie Folgendes:

*Note: Fields marked with * are mandatory for processing your request.

Richten Sie Ihre Testversion von Business Central ein.

mit QUALIA Technik GmbH

Starten Sie Ihre 30-tägige Testphase (bei Bedarf auf 60–90 Tage verlängerbar) mit Expertenhilfe, Beispieldaten oder Ihren eigenen Daten.

Was Sie in Ihrer kostenlosen Business Central-Testversion erhalten

  • 25 Testbenutzer, in wenigen Minuten einsatzbereit
    Wir stellen Ihnen eine CSP Premium-Testversion mit 25 Lizenzen für 30 Tage zur Verfügung – während der Testphase fallen keine Kosten an, und Sie können jederzeit wechseln.

  • Oder wählen Sie den öffentlichen Testpfad (bis zu 90 Tage).
    Starten Sie eine Microsoft „öffentliche/virale“ Testversion mit Ihrer geschäftlichen E-Mail-Adresse, verlängern Sie diese einmal selbst (+30 Tage) und einmal über einen Partner (+30 Tage) für bis zu 90 Tage, bevor Sie ein Abonnement abschließen.

  • Geführtes Onboarding – direkt im Produkt integriert:
    Sie erhalten In- ‑App- Touren, Schulungstipps und eine „Erste Schritte“-Checkliste, sobald Sie sich anmelden, damit Ihr Team Finanzen, Vertrieb, Lagerbestand und mehr souverän erkunden kann.

  • Ihre Daten oder Beispieldaten – Sie haben die Wahl.
    Starten Sie mit einem umfangreichen Demo-Unternehmen oder importieren Sie Starterdateien; Sie können während der Testphase auch Premium- Funktionen für komplexere Szenarien aktivieren.

  • Sichere ‑Partnerunterstützung mit minimalen Berechtigungen (GDAP)
    Wir helfen Ihnen bei der Einrichtung und dem Support Ihrer Testphase mithilfe von granularer delegierter Administration (GDAP).

  • Lokalisiert für Ihren Markt:
    Die Testversionen werden mit den Sprachen und der regulatorischen Lokalisierung für Ihr Land/Ihre Region bereitgestellt.

Bitte lesen und bestätigen Sie Folgendes:

*Note: Fields marked with * are mandatory for processing your request.

Richten Sie Ihre Testversion von Business Central ein.

mit QUALIA Technik GmbH

Starten Sie Ihre 30-tägige Testphase (bei Bedarf auf 60–90 Tage verlängerbar) mit Expertenhilfe, Beispieldaten oder Ihren eigenen Daten.

Was Sie in Ihrer kostenlosen Business Central-Testversion erhalten

  • 25 Testbenutzer, in wenigen Minuten einsatzbereit
    Wir stellen Ihnen eine CSP Premium-Testversion mit 25 Lizenzen für 30 Tage zur Verfügung – während der Testphase fallen keine Kosten an, und Sie können jederzeit wechseln.

  • Oder wählen Sie den öffentlichen Testpfad (bis zu 90 Tage).
    Starten Sie eine Microsoft „öffentliche/virale“ Testversion mit Ihrer geschäftlichen E-Mail-Adresse, verlängern Sie diese einmal selbst (+30 Tage) und einmal über einen Partner (+30 Tage) für bis zu 90 Tage, bevor Sie ein Abonnement abschließen.

  • Geführtes Onboarding – direkt im Produkt integriert:
    Sie erhalten In- ‑App- Touren, Schulungstipps und eine „Erste Schritte“-Checkliste, sobald Sie sich anmelden, damit Ihr Team Finanzen, Vertrieb, Lagerbestand und mehr souverän erkunden kann.

  • Ihre Daten oder Beispieldaten – Sie haben die Wahl.
    Starten Sie mit einem umfangreichen Demo-Unternehmen oder importieren Sie Starterdateien; Sie können während der Testphase auch Premium- Funktionen für komplexere Szenarien aktivieren.

  • Sichere ‑Partnerunterstützung mit minimalen Berechtigungen (GDAP)
    Wir helfen Ihnen bei der Einrichtung und dem Support Ihrer Testphase mithilfe von granularer delegierter Administration (GDAP).

  • Lokalisiert für Ihren Markt:
    Die Testversionen werden mit den Sprachen und der regulatorischen Lokalisierung für Ihr Land/Ihre Region bereitgestellt.

Bitte lesen und bestätigen Sie Folgendes:

*Note: Fields marked with * are mandatory for processing your request.

© 2024 Qualia. All rights reserved

QUALIA Technik GmbH

info@qualiatechnik.de

17, Heinrich-Erpenbach-Str. 50999 Köln

© 2024 Qualia. All rights reserved

QUALIA Technik GmbH

info@qualiatechnik.de

17, Heinrich-Erpenbach-Str. 50999 Köln

© 2024 Qualia. All rights reserved

QUALIA Technik GmbH

info@qualiatechnik.de

17, Heinrich-Erpenbach-Str. 50999 Köln

© 2024 Qualia. All rights reserved

QUALIA Technik GmbH

info@qualiatechnik.de

17, Heinrich-Erpenbach-Str. 50999 Köln