| 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.

Practices, which were previously been done via JavaScript (or custom plugins) that require developer assistance, which business rules cover are as follows:

  1. Lock/Unlock:

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.

  1. 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.

  1. 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.

  1. Recommendation:

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.

  1. 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.

  1. Set Business Required:

With this action, you can simply make the field either required or not required.

  1. Set Visibility:

This is another simple action where we can opt to either show or hide the field.

Naming Conventions

  1. The rule should have a meaningful name.
  2. Not only should your rule have a meaningful name, but the Conditions and Actions display names should also be meaningful.

Scope

Scope matters! When configuring business rules, we have several options for setting the scope.

  1. Entities: Business rules are executed server-side (that is, queued by workflows, plugins, etc.). Works with all forms.
  2. Specific Form: The Business rule is executed client-side (that is, when a user opens the form) for only one identified entity form.
  3. All Forms: The Business rule runs client-side on all forms of the entity (that is, runs when a user opens the form).

Exceptions:

  1. Business Rules will not work on composite fields (like Full Name or the Address composite block).
  2. Business Rules will not work on multi-select option sets.
  3. 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.



About The Blog

Stay updated with what is happening in the Microsoft Business Applications world and initiatives Imperium is taking to ease digital transformation for customers.


More About Us

We provide guidance and strategic oversight to C-Suite and IT Directors for on-going implementations. Feel free to give us a call.

1 331 250 27 17
Send A Message

Ready to Start?

Get a personalized consultation for your project.

Book a Meeting