MB2-716 (Microsoft Dynamics 365 Customization and Configuration) – Business Rules

As I prepare for my MB2-716 exam I’m producing a series of blog posts that collectively should help others revising for the MB2-716 Certification. (Microsoft Dynamics 365 customization and Configuration.) This time I will look at business rules.

Business rules are a truly great feature of Microsoft Dynamics 365 as they allow us to configure rules to complete many actions on entities that previously would have required a developer to write JavaScript code. For example, with a business rule we can decide when fields are visible. Unlike workflows business rules are triggered as users interact with the form giving instant feedback.

As you revise I highly recommend you often refer to the skills measured statements to ensure you are deeply aware of all the required knowledge. The statement for business rules is below;

With business rules we can create complex rules that conditionally effect the user experience by allowing us to;

  • Offer recommendations to users
  • Lock / unlock (enable/disable) fields
  • Show error messages
  • Set fields to specific values
  • Set default values
  • Make fields mandatory
  • Hide and show fields

All of these changes would have needed the assistance of a developer in earlier versions of “CRM” but now they can be achieved simply with configuration. This doesn’t mean JavaScript is redundant as it may still be required if highly complex logic is required or when limitations of business rules come into play. For example, within a business rule we can hide and show fields on the form. But we can’t hide / show sections or tabs. If that is needed we’d still resort to JavaScript.

It is actually possible to hide a section without JavaScript if we individually hide all of the fields in the section, as once all of the fields are hidden the section will hide.

Another nice thing about business rules is we can define their scope, so that they can be applied to a specific form, all forms or even operate at an entity level. Business rules represent client-side logic that is applied on the form as the form is opened. Also, additionally, when defined as entity level the business rule logic can be applied at a server level. Meaning server side business rules run client-side and server-side. Entity level rule are triggered as users interact with the form AND they run on the server when a record is created or saved.

Business rules that have a scope of “entity” are supported with editable grids.

You should be aware that all of the fields referenced on a business rule must exist on the form (or editable grid). If we have a business rule that runs on a form that references fields that are not available it simply doesn’t run.

You may have already noticed that we have business rule options on the entity, form and even on fields. When viewing business rules, at an entity level we can see all the business rules. When we view the business rules from a form we’ll see all the rules that apply to that form. And if we view them from a field within a form we’ll see only the business rules which could use or impact that specific field. Meaning the rules are displayed from the perspective that they are being viewed.

Business Rules Scope

There are three options possible for the scope of a business rule;

  1. Single Form Scope – Use this when a business rule specifically applies to a single form. It involves selecting a specific form name.
  2. All Forms – Use this to apply the business rule to all forms. (Including main and quick create forms.)
  3. Entity – Use this to run the business rule at a form and server level. (Server level being triggered by a create or update of data.) Useful if the rule is to be applied not only on forms but when data is imported. Also useful if the business rule is to be applied to editable grids.

Tip: To change the scope on an active business rule, you will need to deactivate it before making the change. (Or any change to an active rule for that matter!)

Business Rule Designer

The introduction of Dynamics 365 gave us a new form designed for business rules. Meaning we can create business rules using a drop and drag interface. The designer also gives a graphical representation of business rules that help to make them easy to understand.

When the new designer was first launched I created a blog post to describe this new feature. You may find that post useful. (It also describes the recommendations feature!) You can view that post here.

Part of your revision should include getting some hands-on experience of the business rule designer, so that you become familiar with its key features. Including the minim map and text view features.

Business Rules Example

The best way to explain business rules might be to show a quick example. Below you can see an example of a business rule.

All business rules will have at least one condition. But as you can see we can add more if required. Meaning you can create if, else if and else constructs.

Note: There is a limit of 10 if-else conditions on business rules.

Linked to each result of the condition you can add a number of actions. (or other conditions.) As already mentioned these actions can be used to hide fields, set field values etc.

When considering conditions in business rules it is important to be aware that a condition can have several parts and they can have and / or logic applied. (The default being and.)

The rule above has two conditions based on the relationship type with the account. If the account is a customer that I make the price list mandatory, and default the category and payment terms fields. For suppliers we do different things. Etc. Below you can see that because this account has been set to scustomer then the price list is mandatory, and payment terms / category has been given specific values.

Having created and saved your business rule, you will need to ensure it is activated. Once activated you need to deactivate the business rule to change it.

Each action has slightly different parameters. With set field, for example, you pick the field and then opt to set it to a value or another field. The best approach to learn how the different actions work will definitely be to try some out to see what happens.

I hope this post has given you a feel for how business rules work and some of the core concepts you’ll need to cover for the MB2-716 exam. As always, this is an important area to get some hands-on experience of.

3 thoughts on “MB2-716 (Microsoft Dynamics 365 Customization and Configuration) – Business Rules

  1. Pingback: MB2-716 Certification: (Microsoft Dynamics 365 Customization and Configuration) – Revision Guide | Microsoft Dynamics 365 and Unified Service Desk

  2. hi,
    in this statement:
    If we have a business rule that runs on a form that references fields thatare available it simply doesn’t run.

    Is the word ‘not’ missing after ‘that are’?

    Liked by 1 person

Leave a Reply to Neil Parkhurst Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s