THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Master Data Services Team

Blog for the Microsoft SQL Server Master Data Services (MDS) team. Blog posts are contributed by various team members.

Creating a Simple Business Rule

(this post was contributed by Brian Barnett, Senior Software Engineer on the MDS team)

This post is a first in a series that will explore what you can do with SQL Server 2008 R2 Master Data Services (MDS) business rules. It will introduce business rule creation and publishing. Here are some of the topics we will be covering in the future:

  • Using business rules to enable human workflow via email notifications
  • Creating and initiating a SharePoint workflow from MDS business rules
  • Using different types of conditions and actions
  • Using complex conditions
  • Using business rules to propagate attribute changes down a hierarchy
  • Getting creative with business rules.
  • What is happening under the covers when you publish and run business rules

If there are other business rule topics you are interested in please drop us a line at

What are Business Rules?

The ability to validate master data against a variety of rules and conditions is a key component to any best-practice master data management strategy. In MDS, business rules are used to enforce data integrity and help ensure completeness and accuracy of the master data.

Business rules are If/Then statements that can be created in the Master Data Manager user interface (UI) or the WCF API. If an attribute value meets a specified condition, then an action is taken. Possible actions include setting a default value, changing a value, performing attribute validation, or initiating a SharePoint workflow.

To use business rules, you must first create and publish your rules, then validate your data against the published rules. An administrator can validate an entire version of a model at one time. Other users can validate subsets of data against business rules.

If an attribute value doesn’t pass business rule validation, the value can still be saved. Validation issues are displayed in the UI, and a version cannot be committed until all attributes pass business rule validation.

Business Rule Designer

In Master Data Manager, the Business Rule Designer is where you create and edit business rules. Drag and drop plays a key role in creation and editing of business rules, as shown below.

Business Rule Designer

The screen has five main sections.

Section Description


Contains the logical operator, condition, and action components.

Entity-Specific Attributes

Contains all the attributes for the specific entity/member type as well as any explicit hierarchy (consolidated) attributes.


Contains the conditions for which the action clause of the rule should be performed. You drag logical operators and conditions to this section. You can use the logical operators “AND” and “OR” to create combinations of conditions. All rules must have at least one logical operator. If no logical operator exists when you drag a condition component, an “AND” logical operator will automatically be added.

A condition is a Boolean (true or false) expression that is applied to an entity attribute. If the condition is true, the actions for the rule are performed.

A business rule does not require a condition. If no condition is specified, the actions for the rule are applied to all members.


Contains the actions that should be performed when the IF conditions are satisfied. You drag actions to this section.

An action is the consequence of a condition evaluation. If a specific condition is true, the action is initiated. You can also create a rule that initiates an action without a condition. In this case, the rule is applied to all members.


When you select a condition component in the IF section or an action component in the THEN section, the Edit section will display the individual condition or action component for editing. You drag attributes to this section as well as select and enter values.

Simple Rule Example

The following steps will show you how to create a simple validation business rule using the sample Product model. Let’s say your business manager has indicated that any product manufactured in-house must have a fabrication time of between 1 and 10 days. So, in MDS we will create this rule:


    InHouseManufacture is equal to Y


    DaysToManufacture must be between 1 and 10

  1. In Master Data Manager, click System Administration.
  2. From the menu bar, point to Manage and click Business Rules.
  3. On the Business Rule Maintenance page, from the Model list, select the Product model.
  4. From the Entity list, select the Product entity.
  5. From the Member Type list, select the Leaf member type.
  6. From the Attribute list, leave the default of All.
  7. Click Add business rule.
  8. Click Edit selected business rule to open the Business Rule Designer.
  9. In the Components pane, expand the Conditions node.
  10. Click the “is equal to” condition and drag it to the IF pane's Conditions label. Notice that an “AND” logical operator is automatically added for you. If you need to start out with an “OR” then make sure you drag it over first.
  11. In the Entity-Specific Attributes pane, click the “InHouseManufacture” attribute and drag it to the Edit Condition pane's Select attribute label.
  12. In the Edit Condition pane, enter Y in the Attribute value field.
  13. In the Edit Condition pane, click Save. The condition will be displayed.
  14. In the Components pane, expand the Actions node.
  15. Click the “must be between” condition and drag it to the THEN pane's Action label.
  16. In the Entity-Specific Attributes pane, click the “DaysToManufacture” attribute and drag it to the Edit Action pane's Select attribute label.
  17. In the Edit Action pane, enter 1 in the “must be between” Attribute value field and 10 in the “and” Attribute value (as shown above).
  18. In the Edit Action pane, click Save. The action will be displayed.
  19. Click Back to return to the Business Rule Maintenance page.
  20. Optionally, on the Business Rules Maintenance page, for the row that contains your business rule, double-click a cell in the Name and Description columns to update the value.
  21. Click Publish Business Rules
  22. On the confirmation dialog box, click OK. The rule’s status will change to Active.

Try it out

Now that the rule is published you are ready to try it out.

  1. Go back to the home page.
  2. Select the Product model and a version.
  3. Select Explorer.
  4. On the Explorer page click the Edit button.
  5. Select Edit Member from the popup menu to edit a member that has InhouseManufacture = Y.
  6. Ensure the Supply Chain tab is active.
  7. In the Attributes section click the Edit button.
  8. Change the “DaysToManufacture” to 11.
  9. Click Save.

Because the updated value is outside the allowable DaysToManufacture range, a validation issue is created and displayed at the bottom of the screen showing the value violates the business rule we entered and published.


This was a simple example to get you started but you can see where we could add several more rules with more complex conditions to ensure DaysToManufacture is valid for a wide variety of product lines.

In the next Business Rules post, we will look at more advanced business rule capabilities by using business rules to enable human workflow via email notifications.

Published Wednesday, February 3, 2010 2:07 PM by MDS Team
Filed under: ,



Paul Kotlyar said:

I have been playing around with the CTP and noticed that in order to start an external sharepoint workflow, the Workflow Service needs to be running on the same machine as Sharepoint. Will there be any support for starting a workflow on a remote farm in RTM?

February 6, 2010 12:37 AM

Master Data Services Team said:

(this post was contributed by Brian Barnett, Senior Software Engineer on the MDS Team) In my last post

February 15, 2010 3:06 PM

Peter P said:

where can i find the "Product Model"?

June 23, 2010 3:11 AM

MDS Team said:

Hi Peter,

You can find the model deployment packages here after you install MDS -

<drive>\Program Files\Microsoft SQL Server\Master Data Services\Samples\Packages

One of those packages is the Product package.  Use model deployment to deploy the Product model into MDS.


June 23, 2010 8:58 AM

adet said:

how can I apply complex business rule to a column?


Day(DateColumn) is equal to 15 OR Day(DateColumn) is equal to 30

Then Action

October 27, 2010 9:20 PM

adet said:

How can i use the must contain the pattern action?

June 18, 2013 2:46 AM

leo said:

I need to set current flag on attribute, so that only 1 record for given year will have value. Can I accomplish this with Business Rule?

Thank you

March 27, 2014 10:58 AM

Christian Gabriel Ramos said:

buenas tardes:

Espero que te encuentres buen, tengo una duda sobre las reglas de negocio de MDS, espero me puedas orientar.

El detalle es en una regla de negocio en la cual valido un campo de una entidad basado en dominio, y dependiendo de su valor, evaluó el valor de un atributo de la entidad.

ejemplo tengo una entidad llamada "Catálogo Administrados" , está tiene un atributo basado en dominio de otra entidad llamada "Tipos Actualización"

existe otra entidad "Catálogo Motivos de Cambio", está tiene un atributo basado en dominio con la entidad de "Catálogo Administrados", y con otra entidad llamada "Grupo Información",

La entidad "Grupo Información" tiene un atributo basado en dominio de otra entidad llamada "Tipos Actualización".

Generó una regla de negocio para la entidad "Catálogo Motivos de Cambio" que queda de la siguiente manera.


   DBA.Grupo Información.TiposActualización no es igual que DBA.Catálogo.Tipos Actualización OR (DBA.Grupo Información.Activo no es igual que 1)


   Grupo Información no es válido

El problema es que si yo hago un cambio en el atributo de "Tipos de Actualización" de la entidad de  "Catálogo Administrados",  la regla no se aplica sobre la entidad, dejando los registros como correctos cuando en realidad ya no se cumple la regla, tengo que publicar las reglas nuevamente aunque no haga ningún cambio, así si aplica la regla.

sabes si existe alguna solución para este problema?

May 9, 2014 6:53 PM
New Comments to this post are disabled
Privacy Statement