Stoetech


From time to time, as Users are editing forms, we might want immediate feedback to help guide them. This can be useful for many different reasons. Let’s try some examples of what is possible with Business Rules to help you understand their power.

Ex. 1    Making mandatory fields.

Ex. 2    Populate error messages.

Ex. 3    Set default values to fields.

Ex. 4    Hide and show fields.

Ex. 5    Lock and unlock fields.

Ex. 6    Giving a recommendation to a user.

These can all be satisfied with Business Rule implementations. A few years ago, none of this could be done without writing custom JavaScript. Business rules allow admins to bridge the gap and act as a developer without writing a single line of code. There is still a lot of use when it comes to knowing how to use JavaScript. For example, your client wants you to hide a section or tab from a Form. You can either do this by individually hiding all the Fields in that section or tab, or you can write a couple of lines of JavaScript.

Business Rules are different from Workflows in that Business Rules happen as fields are changed on forms. Business Rules give immediate feedback, which helps correct user behavior as they interact with Forms.

Business Rules are triggered when a record is opened, or a field is changed.

Warning: All Business Rule Fields must be in the Form or the Business Rule won’t perform.

Rule Designer

The Rule Designer is an easy-to-use, Drag/Drop interface.


Rule Designer Interface

Conditions

If/else conditions

  • Allows creation of alternate condition if first, if, is not met.
  • Limit of 10 if/else conditions

Otherwise

  • If not

And or “or”

  • Used to group separate statements

Actions

Actions are what we want to be performed with a Business Rule. Below are the different actions that can be performed, along with an image of what they look like in the Rule Designer.

  • Recommendation
  • Show error message
  • Set field value
  • Set business required
  • Set visibility
  • Set default value
  • Lock or unlock field

Business Rule Scope

Entity — All Forms and server

All Forms — All forms

Specific Forms — Just that Form

Activation, Validation, and publishing solution

When finished with your Business Rule, be sure to activate it.

The activate button

If there is anything wrong with the Business Rule it should be displayed in red. If using a Business Rule inside of a Solution, make sure that the Solution is published.

Business Rules in the Solution. Be sure to “Publish All Customizations” in a Solution

You have probably seen Business Rules implemented on various websites that you use before. They are incredibly powerful, especially because they are easy to implement. Be sure to go out there and practice creating one on your own.

I quickly created a Business Rule to show how easy it is to do. This took me about three minutes to create. In my Business rule, I wanted to make the “Street 1” to be a required field.

I made the condition that

  • IF the relationship type is equal to “Customer”
  • THEN Set Address 1 as Business Required.
  • Else Set Address 1 as Not Business Required.

As you can see below, there is now a red star above the “Street 1.” Success!

The definitions are based on the Microsoft Dynamics 365 website. I encourage you to look at them. These documents are helpful when you want to learn more in-depth on any subject.




Author: Taylor Johnson
I am a Microsoft Dynamics 365 Professional writing a blog to provide free education for all. I will be posting courses that teach the various subjects needed to be a professional in this field. I welcome you to contact me to discuss inquiries about working on your platform.

Leave a Reply