In Part 6 of this Master Data Services blog series we will look at how we enforce quality standards and ensure accuracy in our master data by implementing business rules. In the prior parts to this series, we have spent time reviewing important Master Data concepts and MDM architectures. We also looked at configuring MDS before learning about the model, entities, attributes and members. In our last post we looked at derived and explicit hierarchies before being introduced to collections.
Part 1 – Understanding Master Data
Part 2 – Master Data Management Architectures
Part 3 – Installing Master Data Services
Part 5 – Hierarchies & Collections
At the risk of over simplifying the discussion, it is worth using a couple of lines to define the term business rule. A business rule defines a constraint on a business, its process or its data. These rules can exist in many forms whether formal, or informal, written or unwritten. One fact that needs to be established however is that business rules should always resolve to either true or false. Let’s look at a couple examples of business rules and how they would be evaluated:
- A customer must supply an email address (Email Address is not NULL or Empty).
- A customer must be 21 years or older to purchase beer or wine (Age greater than 21).
- Customer who reside in Florida must have a Hurricane Insurance (State is Florida and Has Hurricane Insurance is true)
Business Rules and Master Data
Now that we have a handle on business rules it is important to understand what role they play in regards to master data. If you think back to Part 1 of this blog series, one of the primary goals of managing master data is to provide a single consistent view of uniquely identifiable data. In other words, we are trying to get to an authoritative or single-version of the truth with our master data. In order to accomplish this, we have to be able to enforce constraints that allow us to ensure accurate, high quality and dependable data. This is the primary justification behind business rules and the reason they are an integral part of MDS and any Master Data Services implementation.
MDS Business Rules
Business rules in MDS take the form of a IF/THEN statement, which you are probably more than familiar with. IF some condition is TRUE, then some action occurs. The condition portion of the statement is an attribute value comparison that can compare equal to, not equal to, greater or less than, starts or ends with and contains based on a value, subset of values or regular expression pattern.
Conditions are flexible in that you can combine two or more when implementing a business rule to build more complex rules. A common example for this scenario would be a business rule that is built around a range of values such as requiring a customer’s age to be between 18 and 25.
Once a condition evaluates to true, some action is executed. In Master Data Services, there are numerous actions that are available but we can define them by breaking them into four core groups based on the action they take when executed. The four action groups are: Default Value, Change Value, Validation and External Action.
Default Value actions, as you could probably guess are actions that set the attribute value only when it has not been specified or is NULL. Change Value actions, while similar in that they alter an attribute value, are different in that whenever the condition is met, the action alters the attribute value regardless if a value has been previously set. Validation actions allow you to change the validation status of the member to invalid and can fire the notifications. Finally, there is a single External Action which provides a method to kick off a SharePoint Workflow when the condition is met.
The final point to make regarding actions is that actions have a defined priority order for which they execute which overrides any priority you’ve established for your business rules. Business Rules with Default Value actions will always fire first, Change Value actions second, Validation actions third and finally External Action last. It’s important to keep in mind that the priority order you define only works within these groups as you define your business rules framework.
Managing Business Rules
To start working with Business Rules we need to get to the Business Rules Maintenance page in the Master Data Manager. You can navigate to this page by clicking on the System Administration link and then using the menu to select Manage and then Business Rules.
Once on the Business Rule Maintenance page, you will be prompted to select a Model and then the Entity for which you are defining a business rule. You can select the Member Type as either Leaf, which is the default, or Consolidated if you wish to target the business rule at consolidated members. Additionally, you can build business rules that target individual attributes by selecting the attribute name from the Attribute prompt rather than the default value which is all.
|Business Rule Maintenance||Business Rule Maintenance & Rule Grid|
The Business Rule Maintenance page has four icons which allow you to add a new business rule, publish business rules, edit an existing business rule as well as delete a business rule. The Business Rule grid also has a number of features to point out.
|Add Business Rule|
|Publish Business Rules|
|Edit Selected Business Rule|
|Delete Selected Business Rule|
First, if you double-click on the Priority value, you can alter the priority for the business rule. The same methodology is used for the Name and Description columns. You can Exclude a business rule, by click the checkbox in the exclude column. Excluding business rules is a form of a soft-delete or a way to disable a business rule without actually deleting it.
|Inline Editing Rule Properties||Defining Business Rule Notifications|
If you hover over the Expression column, a helpful tooltip will display the business rule in its IF/THEN written form. Last, is the Notification column, which allows you to select either a Group or User (or None) to notify when the business rules fires the notification process.
As you click around the columns in the grid, I want to point out the Status column which changes based on the actions taken (Changes pending, Activation Pending, Exclusion Pending, Deletion Pending, Active, etc.). You must publish the business rules by clicking the Publish button to formally commit the changes to the model.
Creating and Publishing Business Rules
To create a new business rule, click the Add Business Rule icon. You will notice that a new row has been added to grid of business rules with a default name similar to New Rule (1) and a status of Rule not defined. I am working the Product model that is available when you install MDS so I will be creating a simple validation business call for the Safety Stock Level. The rule will simply determine if the Safety Stock value is less than or zero.
|Add a new business rule|
Double-click the Name column and give the rule a descriptive name. Repeat the same process to provide a friendly description for the business rule. Now we are ready to edit the business rule. Click the Edit Selected Business Rule icon to launch the Business Rule Editor.
|Naming and describing the new business rule|
The Business Rule Editor is the dialog we will use to build the guts of the business rule. On the left-hand side of the editor, you will see a section called Components. This section contains our conditions, actions as well as the logical operators we can use to build business rules with multiple conditions. Just below the Components section is the Attributes pane which provides us with a list of all the attributes that are available for building business rules.
|Business Rule Components||Business Rule Attributes|
On the right-hand side of the dialog, the expression section is where we will drag the components and attributes to in order to build the business rule. Start by expanding the Conditions nodes and then the Value comparison node. Click and drag the “is less than” condition from the Component pane to the the Conditions node under the IF section of the Expression pane.
Selecting Business Rule Condition
Once you drop the condition on the condition node, the Edit Condition section dialog updates so that we can wire up the attribute to the condition.
Wiring Attribute to Condition
Next find the SafetyStockLevel attribute in the Attributes section. Click and drag the attribute to the Select attribute node in the Edit Condition section. After you drop the attribute notice that the dialog updates so that SafetyStockLevel has replaced the Select attribute node name. Ensure that Attribute Value is selected and that the value for comparison is set to zero. Click the disk icon to save the business rule condition.
Condition After Save
Now that we have defined the condition of our business rule, we must specify the action or the THEN portion of the rule. Expand the Actions node and then Validation node in the Components section. Click and drag the “must be greater than” action to the Actions node in the THEN section of the Expression pane.
Selecting Business Rule Action
The Edit Action dialog again updates and is ready to wire the attribute to the action. Click and drag the SafetyStockLevel attribute to the Select attribute node in the Edit Action section. Check that Attribute Value is selected and that the value for display is zero. Click the disk icon to save the business rule action.
|Completed Business Rule|
Now that the business rule is complete, you can click the green back arrow to navigate back to the Business Rule Maintenance screen. Once back, notice that the status for the new business rule is Activation Pending. Before the business rule is activated we must publish our business rules.
|Business Rule Pending Publishing|
After you publish your business rule to make it active, you can use the Master Data Manager Explorer to test the business rule. For this rule, I’ve simply navigated to one of the products and set the SafetyStockLevel to ?1. A red exclamation point indicates that validation failed and I am given a detail reason why the business rule failed using the rule description and the business rule expression.
|Validating the Business Rule|
In this post we looked at business rules and how they are implemented in Master Data Services. We walked through using the Business Rule Editor to create a simple validation rule and then validated that the rule worked as designed using the Master Data Manager Explorer. In the next post in this series we will shift gears away from building out the MDS Model and look at how versioning and transactions are handled.
Till Next Time!