| Anas Arshad
Business Rules in Model-Driven Forms
Business rules are a no-code way of applying rules to forms in Dynamics. A business rule consists of conditions and actions. You can add up to 9 conditions to one business rule. Each condition has a true/yes branch and a false/no branch and, then add actions to each of these branches as needed.
Lock/Unlock allows the users to make fields read-only or allow them to be edited. This is a simple action that offers great benefits that make the user's day-to-day work more efficient.
- Show Error Message:
Show error message allows you to view the error message. If we set a field with a red 'X' to appear, the message will be displayed. When We try to save, a message is also displayed at the bottom of the Save button. Users cannot save unless the conditions, that are displaying the error message, are met. This action can be used for various processes, for example validation.
- Set Field Value:
Set Field Values allow users to clear data in a field, set a field to match another field, set a field to a specific value, and use simple formulas.
Although there are some restrictions on the types and values of fields that can be set, this is a powerful action.
This allows you to show a Recommendation message that performs one or more actions. With a Recommendation, Users can choose to apply the Recommendation or dismiss it. User can edit fields modified by recommendations even after recommendations have been applied.
- Set Default Value:
Set Default Value allows you to set a field to match another field, set a field to a specific value, or set a field value using a simple expression. This is very similar to the Set Field Value action.
- Set Business Required:
With this action, you can simply make the field either required or not required.
- Set Visibility:
This is another simple action where we can opt to either show or hide the field.
- The rule should have a meaningful name.
- Not only should your rule have a meaningful name, but the Conditions and Actions display names should also be meaningful.
Scope matters! When configuring business rules, we have several options for setting the scope.
- Entities: Business rules are executed server-side (that is, queued by workflows, plugins, etc.). Works with all forms.
- Specific Form: The Business rule is executed client-side (that is, when a user opens the form) for only one identified entity form.
- All Forms: The Business rule runs client-side on all forms of the entity (that is, runs when a user opens the form).
- Business Rules will not work on composite fields (like Full Name or the Address composite block).
- Business Rules will not work on multi-select option sets.
- We cannot use a Business Rule to interact with tabs, sections, and/or sub-grids.
Join us next time, as we continue our journey of learning canvas apps.Click here to learn more about Imperium's Power Apps Services. We hope this information was useful, and we look forward to sharing more insights into the Power Platform world.