Business Rules guide users through forms by auto-populating field values (Set Field Value), highlighting required fields (Set Business Required), restricting access to certain fields (Lock/Unlock Field) or hiding them completely (Show/Hide Field), and displaying an error message if what they entered does not make sense (Show Error Message).
Up until recently, all Business Rules were causation relationships. Based on certain values entered by the user, actions had to be performed. A implies B. Dynamics 365 has given system administrators and business analysts more freedom in how to guide a user through the system. Business Recommendations are defined by correlation relationships. If A occurs, there is a high probability that B will occur.
In this blog, we will define Business Rule terminology and explore the Business Rule Designer through two examples. These examples could be generalized to any business model, but here, we will look at a health insurance provider and two possible examples of what their system administrator and business analyst could implement to help their users enter the correct information on the Contact entity.
What are Business Rules?
Business Rules are logically applied to entities that system administrators create and maintain to help aid the organization and their defined process. Business Rules follow an “if… then…” structure. If a condition is met (combination of rules), then perform an action such as Lock/Unlock a field, set the Business Requirement level of the field, or present a Recommendation.
Business Rule Designer
Dynamics 365 Customer Engagement released the Business Rule Designer. Similar to the Sitemap Designer, this feature is a drag-and-drop business rule generator.
Business Rule Designer Terminology
Save, Validate, Activate – these are your primary commands. Save updates changes to the business rule. Validate is a new feature for Dynamics 365. This checks the logic within your business rule to confirm there is nothing missing. Activate turns your business rule on and will be applied in the environment.
The Components Tab of the Components and Properties Side Panel is a more detailed view of the +Add Button. Both areas let you add Flows or Actions. A Flow is a Condition (the “If…”). Action can be Lock/Unlock, Show Error Message, Set Field Value, Set Default Value, Set Business Required, Set Visibility, or Recommendation (the “then…”). The Properties Tab of the Side Panel lets you customize Flows and Actions. Snapshot takes an image of the Canvas area so you can review the logic in a flow-chart view.
The scope defines where this Business Rule will be applied. Business Rules can be applied to the entire Entity, All the Forms, or specific Forms (such as the Information Form).
Scenario 1: Business Required
You are a system administrator at a health insurance provider. Management has alerted you to the fact that the marketing team has issues bulk emailing customers since some contacts in the system do not have an email address, even though the contact has stated that their preferred contact method is email. You need to ensure that if the “Primary Contact Method” field is email, then the “Email” field is Business Required.
Within Dynamics 365, fields can be Optional, Business Required, or Business Recommended.
A Business Required field must have data in the field for the user to save the record. They are denoted by the Red Star next to the field name (Ex: Full Name)
Not Business Required – the default when creating a field. This means the user can add data to this field, or keep it blank. The user can save the record with or without data in this field. Most fields are Optional (Ex: Job Title)
Business Recommended fields are highly encouraged by the business to contain data, but they are not required. The user can still save the record without having data in that field. They are denoted by the Blue Plus next to the field name (Ex: Account Name)
For this scenario, we will create a Business Rule to set the required level of the “Email” field.
Create a new Business Rule. There are two ways to start a new Business Rule.
A – Within the Solution, open the Entity and select Business Rules to see a full list of Business Rules on that Entity. Click New to open the Business Rule Designer.
B – While looking at a form for the Entity, click on the Business Rules button and click New Business Rule at the bottom to open the Business Rule Designer.
Define Rule.Best Practice Tip:
Before you add components, add a Name and a Description for your rule and press Save – this will create your Rule within CRM.
Define the Flow Property.From within the Canvas area, click on the purple Condition box. This will automatically toggle the Components and Properties Side Panel to the Properties tab.
For this scenario, we want the If Statement to read, “If the Preferred Method of Contact is Email”. The Properties translation of this statement is shown in the image to the right.
The source describes where the Field resides. It can be an Entity or Business Process. For this example, we will select Entity.
Click the Apply button. This will update the Property and you will see the new Display Name within the Canvas area.
Add the Action. From the Components tab, select Set Business Required and drag-and-drop onto the Canvas area.
Define the Action. Similar to Step 3: Define the Flow Property, add a Display Name, select the Field and set the Status to Business Required. Click the Apply button to see your changes in the Canvas area.
Best Practice Tip:
Always have an “Else Action”. Up to this point, we have created an “If… Then…” statement. You should also include an “Else” part of the rule. All Business Rules should read “If… Then… Else…”
For this example, our statement is “If Preferred Contact Method is Email, set Email to Business Required, else set Email to Not Business Required”
Validate and Activate Inspect the Canvas area to make sure the Business Rule has the correct logic.
Click Validate in the Primary Commands area and then Activate.
This is the result:
Scenario 2: Recommendation
Just as in the last scenario, you are a system administrator at a health insurance provider. You have been tasked with working with a business analyst to help streamline the plan selections. The BA explains that there is a high correlation between Gold/Silver General Plan Members and Premium Vision Insurance. Specifically, 79% of the Gold Plan Members have Premium Vision and 64% of the Silver Plan Members have Premium Vision. You want to help guide the Member Benefits Team users to confirm Vision Insurance when the Plan Level is changed to Gold or Silver.
This scenario screams Business Recommendation since it is a correlation relationship and not a causation relationship. “Most of the time, Gold Members also have the Premium Vision additional insurance” means it is highly likely that the Member Benefits Team should update the “Vision?” field, however, there might be a situation where a Gold Member does not have Premium Vision insurance with us, so we do not want to automate this process.
As a note, if the statement was “Gold Members are automatically enrolled in our Premium Vision plan” then we could use a Set Field Value Business Rule to update the “Vision?” field automatically on change of the “Plan Level” field.
Complete Steps 1-3 as defined above. The If Statement for this scenario is “If Plan Level is Gold or Silver”.
Add the Recommendation.Select the Recommendation Action and drag it to the canvas.
The Recommendation Name is what will show on the Canvas and will be part of the Snapshot when you want to review the logic in a flow-chart manner.
The Field area is where the Recommendation Icon will be displayed:
The Recommendation Title is what is displayed as the title to the Recommendation.
Recommendation Details provides more information to the user and describes what the recommendation will apply if selected.
Define the Action. Every Recommendation has an Action of type Set Field Value. The Recommendation will suggest a field value for the user to Apply or Dismiss. Here, we will ask the user if they want to Update Vision to Yes – Premium.
Validate and Activate. Inspect the Canvas area and click the Validate button to confirm there is no faulty logic. When satisfied, Activate the Business Rule.
This is the result:
If you hide every field in a section, it will be hidden from the form.
Use case: our Health Insurance Provider database has both customers and hospital contacts as part of the Contact entity. If the Contact is a Hospital Contact, we do not care about the “Plan Details” section since it does not make sense in this context. We would create a business rule with the following information:
If Contact Type = Hospital Contact, then Hide Plan Level and Vision, else Show Plan Level and Vision.
This will completely hide the Plan Details section (including the Plan Details Label).
Awesome! How do I get started?
Personally, I love to white-board the logic first. It is then very easy to drag-and-drop the details into the Canvas area of the Business Rule Designer. For new deployments, this is very easy since you have the flexibility of Sandbox, Development, and Testing environments.
If you already have Dynamics 365 Customer Engagement, it is best practice to add your new Business Rules and Recommendations to a sandbox or development environment, test, and then push the update to production during a period where your users will experience minimal impact. I would also notify the users of the pushed update – over-communicate when it comes to user adoption and training.