Introduction to Business Rules - Dataverse Tables




Business Rules


In this Blog, 

Im gonna introduce you to Business Rules in Dataverse Tables, show you how to create a Business Rule & disclose some important points regarding Business rules.


Introduction to Business Rules

Business rules are used to validate data inside a Dataverse table.

You can create business rules and recommendations to apply logic and validations without writing code or creating plug-ins. Business rules provide a simple interface to implement and maintain fast-changing and commonly used rules

By combining conditions and actions, you can do any of the following with business rules:


Set column values
Clear column values
Set column requirement levels
Show or hide columns
Enable or disable columns
Validate data and show error messages
Create business recommendations based on business intelligence.


Column type support with business rules

Business rules work with most column types including,

Text
Number
Choice
Date
Lookup
Owner
Image


Note

Model driven apps can use all actions available on business rules, however not all business rule actions are available for canvas apps at this time.

These actions are not available in canvas apps:

Show or hide columns
Enable or disable columns
Create business recommendations based on business intelligence.

Note

If business rule is created with scope as “Entity” then the business rules will execute server side.
This means that you do not need the CRM form for the rules to be executed.
It can also be executed when you do updates to a record programmatically similar to the concept of Workflows and Plugins.

Scope

Entity scope enables business rules to run on Model-driven app forms and server

All Forms scope enables business rules to run on Model-driven app forms


Create a business rule


Sign in to Power Apps, on the left navigation pane expand Data.


In the list that appears, select Tables.


Open the table you want to create the business rule for (for example, open the Account table), and then select the Business Rules tab.





Select Add business rule.





The business rule designer window opens with a single condition already created for you. Every rule starts with a condition. The business rule takes one or more actions based on that condition.




Add a description, if you want, in the description box in the upper-left corner of the window.


Set the scope from the right-top corner.


By Default a condition is already created. You need to configure it.


Add Actions from the component bar on the ride side.


You can add the following actions

Set column values

Clear column values

Set column requirement levels

Show or hide columns

Enable or disable columns

Validate data and show error messages

Create business recommendations based on business intelligence.





Save and Activate.


Test your business rule in your app.




Points to note

Business rules don't work on canvas apps if scope is 'all forms'

Business rules run on canvas apps if set to 'entity'

Business rules actions like hide/lock doesn't work on canvas apps

Business rules actions like display error only works when the data is being submitted to the Dataverse inside canvas apps





I hope this Blog was useful to you. If you like the blog give it a thumbs up.
Feel free to ask questions or give suggestions in the comment box down below:

Comments