Business Rules (Model-Driven Apps & Dataverse)

Business Rules in Microsoft Dataverse

Business Rules allow you to define logic, validations, and UI behavior on Dataverse table forms without writing code. They work mainly inside model-driven app forms and partially in server-side operations depending on the scope.


1. Scope of Business Rules

  • Entity – Applies to all forms of the table and also runs server-side when the record is created or updated by API/flows.
  • All Forms – Applies to every model-driven form associated with the table.
  • Specific Form – Applies only to the selected form.

Note: Canvas apps require the rule to be set at table (Entity) scope, but Canvas apps support only limited actions.


2. Components of a Business Rule

  • Condition – Evaluates field values or expressions.
  • Set Field Value – Automatically fills or changes a field value.
  • Clear Field Value – Removes existing values.
  • Set Business Required – Makes a field Required, Optional, or Recommended.
  • Set Visibility – Shows or hides fields or sections.
  • Lock / Unlock – Enables or disables editing of a field.
  • Show Error Message – Displays validation messages on the form.
  • Recommendation – Shows a suggestion panel with a title, description, and optional action button.
  • Business Rule Text View – A read-only textual summary of the logic.

3. Canvas App vs Model-Driven App Support

Model-Driven Apps support all Business Rule actions.

Canvas Apps do not support:

  • Show or hide columns (Set Visibility)
  • Enable or disable fields (Lock / Unlock)
  • Recommendations

Only simple field value updates work in Canvas apps; UI actions do not.


4. Business Rule Example


Business Rule logic on the User Owned table:
IF
  Display Name contains "test"
THEN
  Lock BusRules
  Set BusRules = "Test"

ELSE
  Show Recommendation: "New Recommendation"
     Title: "Testing"
     Details: "Write value as test"
  Set BusRules = "no test"
  Lock BusRules

Explanation:

  • If Display Name contains "test", the BusRules field becomes locked and is set to "Test".
  • If not, a recommendation appears, BusRules is set to "no test", and the field is locked.
  • Lock/Unlock and Recommendations run only in model-driven forms.
  • To activate the business unit you need to click activate button present at the top of the designer.

5. Limitations

  • Too many Business Rules on a table can slow form load.
  • Rules only execute for fields present on the form.
  • UI actions do not execute server-side.
  • Certain column types (multi-select choice, file, image) have limited support.
  • Conflicts may happen when multiple rules modify the same field.

Comments

Popular posts from this blog

Part 1: Creating Code Apps in Power Apps - A step-by-step guide (with real errors I faced & how I fixed them)

Calling Microsoft Graph API from Power Automate Using Azure App Services – Step-by-Step Guide

Step-by-Step Guide: Power Automate Custom Connector Using Graph API from Azure App Service