业务规则 (Master Data Services)Business Rules (Master Data Services)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) - 仅限 Windows 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) - Windows only 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance

Master Data ServicesMaster Data Services中,业务规则是您用于确保主数据的质量和准确性的规则。In Master Data ServicesMaster Data Services, a business rule is a rule that you use to ensure the quality and accuracy of your master data. 可以使用业务规则自动更新数据、发送邮件或启用业务流程或工作流。You can use a business rule to automatically update data, to send email, or to start a business process or workflow.

若要查看业务规则示例,请参阅业务规则示例 (Master Data Services)To view examples of business rules, see Business Rule Examples (Master Data Services).

创建和发布业务规则Create and Publish Business Rules

业务规则是您在 ssMDSmdm 中创建的 主数据管理器Master Data Manager语句。Business rules are If/Then/Else statements that you create in 主数据管理器Master Data Manager. 如果属性值符合指定条件,会执行操作,否则执行 Else 操作。If an attribute value meets a specified condition, then an action is taken, otherwise a Else action is taken. 可能的操作包括设置默认值或更改值。Possible actions include setting a default value or changing a value. 这些操作可与发送电子邮件通知这一操作结合使用。These actions can be combined with sending an email notification.

业务规则可以基于特定属性值(例如,如果 Color=Blue,则执行操作),或在属性值发生更改时(例如,如果 Color 属性的值发生更改,则执行操作)应用。Business rules can be based on specific attribute values (for example, take action if Color=Blue), or when attribute values change (for example, take action if the value of the Color attribute changes). 有关跟踪非特定更改的详细信息,请参阅更改跟踪 (Master Data Services)For more information about tracking non-specific changes, see Change Tracking (Master Data Services).

若要使用业务规则,您必须首先创建和发布规则,然后将已发布的规则应用于数据。To use business rules you must first create and publish your rules, then apply the published rules to data. 您可以通过验证某一版本,将规则应用于该版本的数据的子级或全部数据。You can apply rules to subsets of data or to all data for a version by validating the version. 在所有属性都通过业务规则验证前,不能提交版本。A version cannot be committed until all attributes pass business rule validation.

如果用户尝试添加未通过业务规则验证的某一属性值,仍可以保存该值。If a user attempts to add an attribute value that doesn't pass business rule validation, the value can still be saved. 您可以查看并纠正在 主数据管理器Master Data Manager中显示的验证问题。You can review and correct validation issues, which are displayed in 主数据管理器Master Data Manager.

在您创建模型部署包时,如果想要包括业务规则,则必须包括来自该包中版本的数据。When you create a model deployment package, if you want to include business rules you must include data from the version in the package.

如果您创建使用 OR 运算符的业务规则,应为可以独立进行计算的每个条件语句创建单独的规则。If you create a business rule that uses the OR operator, you should create a separate rule for each conditional statement that can be evaluated independently. 然后,您可以根据需要排除规则,提供更高的灵活性以及更便于排除故障。You can then exclude rules as needed, providing more flexibility and easier troubleshooting.

如何应用业务规则How Business Rules Are Applied

你可以通过上移和下移业务规则来设置要运行的规则的优先级顺序。You can set priority order for rules to run in by moving business rules up and down. 但是,在考虑优先级前,基于规则执行的操作类型应用业务规则。However, before priority is taken into account, business rules are applied based on the type of action the rule takes. 该顺序如下所示:The order is as follows:

  1. 默认值Default Value

  2. 更改值Change Value

  3. 验证Validation

  4. 外部操作External Action

  5. 用户定义的操作脚本User Defined Action Script

在这些组内,操作按从最低到最高的优先级顺序应用。Within these groups, actions are applied in priority order, from lowest to highest. 因此,例如,四个单独的规则可能有 “默认值” 操作。So for example, four separate rules might have Default Value actions. 根据 Web 用户界面中指定的优先级顺序,首先执行 “默认值” 操作。The Default Value action that occurs first depends on the priority order specified in the web UI.

其他有关应用规则的重要说明:Other important notes about applying rules:

  • 如果某一业务规则被排除或者未以 “活动” 状态发布,该规则仍可用,但在应用业务规则时不包括它。If a business rule is excluded or is not published with a status of Active, the rule is still available but is not included when business rules are applied.

  • 业务规则适用于所有叶成员或所有合并成员的属性值,但不能同时适用于这两者。Business rules apply to the attribute values for all leaf or all consolidated members, not both.

  • 业务规则可以应用于模型的所有 “打开”“已锁定” 版本。Business rules can be applied to any version of a model that is Open or Locked.

  • 应用业务规则时对数据所做的更改不记录为事务。Changes made to data when business rules are applied are not logged as transactions.

  • 一个业务规则不能包含多个 “启动工作流” 操作。A business rule cannot contain more than one start workflow action.

系统设置System Settings

Master Data Services 配置管理器Master Data Services Configuration Manager 中有两个会影响业务规则的设置。There are two settings in Master Data Services 配置管理器Master Data Services Configuration Manager that affect business rules. 可以在 Master Data Services 配置管理器Master Data Services Configuration Manager 中或直接在“系统设置”表中调整这些设置。You can adjust these settings in Master Data Services 配置管理器Master Data Services Configuration Manager or directly in the System Settings table. 有关详细信息,请参阅系统设置 (Master Data Services)For more information, see System Settings (Master Data Services).

任务说明Task Description 主题Topic
创建和发布新的业务规则。Create and publish a new business rule. 创建和发布业务规则 (Master Data Services)Create and Publish a Business Rule (Master Data Services)
向业务规则添加多个条件。Add multiple conditions to a business rule. 向业务规则添加多个条件 (Master Data Services)Add Multiple Conditions to a Business Rule (Master Data Services)
创建业务规则来要求属性具有值。Create a business rule to require that attributes have values. 要求属性值 (Master Data Services)Require Attribute Values (Master Data Services)
创建业务规则以便基于对属性值的更改执行操作。Create a business rule to take an action based on changes to attribute values. 基于属性值更改启动操作 (Master Data Services)Initiate Actions Based on Attribute Value Changes (Master Data Services)
创建业务规则,将用户定义脚本用作条件Create a business rule to take user-defined script as a condition 业务规则扩展 (Master Data Services)Business Rules Extension (Master Data Services)
创建业务规则,将用户定义脚本用作操作Create a business rule to take a user-defined script as an action 业务规则扩展 (Master Data Services)Business Rules Extension (Master Data Services)
更改现有业务规则的名称。Change the name of an existing business rule. 更改业务规则名称 (Master Data Services)Change a Business Rule Name (Master Data Services)
主数据管理器Master Data Manager 配置为在应用业务规则时发送通知。Configure 主数据管理器Master Data Manager to send notifications when business rules are applied. 配置业务规则以发送通知 (Master Data Services)Configure Business Rules to Send Notifications (Master Data Services)
将业务规则应用于特定成员。Apply business rules to specific members. 针对业务规则验证特定成员 (Master Data Services)Validate Specific Members against Business Rules (Master Data Services)
排除业务规则以便不使用该规则。Exclude a business rule so it is not used. 排除业务规则 (Master Data Services)Exclude a Business Rule (Master Data Services)
删除现有业务规则。Delete an existing business rule. 删除业务规则 (Master Data Services)Delete a Business Rule (Master Data Services)