Evenementer
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
Mat 4 Chance fir matzemaache kënnt Dir e Konferenz-Pak gewannen an op d’LIVE Grand Finale zu Las Vegas kommen
Méi gewuer ginnDëse Browser gëtt net méi ënnerstëtzt.
Upgrat op Microsoft Edge fir vun de Virdeeler vun leschten Eegeschaften, Sécherheetsupdaten, an techneschem Support ze profitéieren.
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.
Wichteg
Business rules defined for a table apply to both canvas apps and model-driven apps if the table is used in the app. Not all business rule actions are available on canvas apps at this time. More information: Differences between canvas and model-driven apps
In a model-driven app, not all business rule actions are available for editable grids. For table based view pages, recommendations can't be created. Editable subgrids don't support business rules. Business rules won't work with other types of dataset controls.
To define a business rule that applies to a form in a model-driven app, see Create business rules to apply logic in a model-driven app form.
By combining conditions and actions, you can do any of the following with business rules:
Forms in 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. The following actions are not available on canvas apps:
Business rules work with most column types including text, number, choice, date, lookup, owner, and image. However, business rules don't work with the following column types:
Sign in to Power Apps, on the left navigation pane, and select Tables. If the item isn’t in the side panel pane, select …More and then select the item you want.
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.
Tipp
If you want to modify an existing business rule, you must deactivate it before you can modify it.
Add a description, if you want, in the description box in the upper-left corner of the window.
Set the scope, according to the following:
If you select this item... | The scope is set to... |
---|---|
Entity | Model-driven app forms and server |
All Forms | Model-driven app forms |
Specific form (Account form, for example) | Just that model-driven app form |
Tipp
If you're building a Canvas app, you must use table as the scope.
Add conditions. To add more conditions to your business rule:
Drag the Condition component from the Components tab to a plus sign in the designer.
To set properties for the condition, select the Condition component in the designer window, and then set the properties in the Properties tab on the right side of the screen. As you set properties, the Microsoft Dataverse creates an expression at the bottom of the Properties tab.
To add an additional clause (an AND or OR) to the condition, select New in the Properties tab to create a new rule, and then set the properties for that rule. In the Rule Logic column, you can specify whether to add the new rule as an AND or an OR.
When you're done setting properties for the condition, select Apply.
Add actions. To add an action:
Drag one of the action components from the Components tab to a plus sign next to Condition component. Drag the action to a plus sign next to a check mark if you want the business rule to take that action when the condition is met, or to a plus sign next to an x if you want the business rule to take that action if the condition isn't met.
To set properties for the action, select the Action component in the designer window, and then set the properties in the Properties tab.
When you're done setting properties, select Apply.
Add a business recommendation (model-driven apps only). To add a business recommendation:
Drag the Recommendation component from the Components tab to a plus sign next to a Condition component. Drag the Recommendation component to a plus sign next to a check mark if you want the business rule to take that action when the condition is met, or to a plus sign next to an x if you want the business rule to take that action if the condition isn't met.
To set properties for the recommendation, select the Recommendation component in the designer window, and then set the properties in the Properties tab.
To add more actions to the recommendation, drag them from the Components tab, and then set properties for each action in the Properties tab.
Notiz
When you create a recommendation, the Dataverse adds a single action by default. To see all the actions in a recommendation, select Details on the Recommendation component.
When you're done setting properties, select Apply.
To validate the business rule, select Validate on the action bar.
To save the business rule, select Save on the action bar.
To activate the business rule, select it in the Solution Explorer window, and then select Activate. You can't activate the business rule from the designer window.
Tipp
Here are a few tips to keep in mind as you work on business rules in the designer window:
This business rule example creates a condition that triggers a message in the task description field when a task is more than 30 days old.
If you have more than one language provisioned for your organization, you'll want to localize any error messages that you have set. Each time you set a message, a label is generated by the system. If you export the translations in your organization, you can add localized versions of your messages and then import those labels back into the Dataverse, so that people using languages other than your base language can view the translated messages.
This section describes common issues that might occur when you use business rules.
Actions or conditions that use Composite attributes aren't supported in apps based on the Unified Interface. Alternatively, you can use actions or conditions on the attributes that comprise the composite attributes. For example, instead of using the Full Name (fullname) attribute, you can use the First Name (firstname) and Last Name (lastname) attributes.
New or existing business rules on a table can cause performance degradation when the rules are activated. Power Platform today supports up to 150 business rules for a single table. Beyond 150 business rules, performance degradation can be experienced. This limit includes both client side (JavaScript) and server side (XAML generated as synchronous plugins) business rules. To avoid performance issues with Dataverse, we recommend that you don't create more than 150 business rules for a single table.
A business rule might not execute because the field referenced in the business rule isn't included with the form.
Open solution explorer. Expand the entity that you want and then select Forms.
Open the form that you want and then on the form designer ribbon select Business Rules.
In the form designer, open the business rule.
In the business rule designer, select each condition and action to verify all the fields referenced in each condition and action.
Verify that each field referenced in the business rule is also included on the form. If not, add the missing field to the form.
When you configure business rules with DateOnly
columns, the dates are in the UTC time zone by default, irrespective of the user's set time zone. This can lead to unexpected results if you're expecting DateOnly
values to align with local time settings.
Suggested Handling: Time Zone Independent setting - To make the DateOnly
columns independent of time zones and display dates in parity with what was configured in the business rule, UTC for example, you can enable the Time Zone Independent setting. For more information about configuring date handling settings, go to Specify the behavior of a date and time column.
Can business rules unlock fields on a read-only form?
How do I troubleshoot a business rule that isn't working?
Do business rules react to changes made by an onLoad script?
When I update a business rule, is it executed against all existing records?
Evenementer
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
Mat 4 Chance fir matzemaache kënnt Dir e Konferenz-Pak gewannen an op d’LIVE Grand Finale zu Las Vegas kommen
Méi gewuer ginnTraining
Modul
Define and create business rules in Microsoft Dataverse - Training
The ability to build business rules that ensure consistent business logic whatever app is accessing that data set is imperative to a successful business operation. This module will show you how you can build business rules that are triggered anytime they're used within Dataverse.
Zertifizéierung
Microsoft Certified: Power Platform Functional Consultant Associate - Certifications
Demonstrate the use of Microsoft Power Platform solutions to simplify, automate, and empower business processes for organizations in the role of a Functional Consultant.
Dokumentatioun
Apply business logic in Microsoft Dataverse - Power Apps
Learn about the different types of business logic you can use in your app
Create model-driven app business rules and recommendations - Power Apps
Learn how to create a business rule for a specific form in Power Apps
About table relationships for Microsoft Dataverse - Power Apps
Learn about table relationships in Microsoft Dataverse