Business rules enable you to set field visibility, value, requirement and other actions without writing JavaScript code in MS Dynamics CRM.

Business rules are great and simple way of specifying:

  • Conditions:
    • Equals
    • Does not equal
    • Contains
    • Does not contain
    • Begins with
    • Does not begin with
    • Contains data
    • Does not contain data, and
  • Actions:
    • Show error message
    • Set field value
    • Set business required
    • Set visibility
    • Set default value
    • Lock or unlock field.

Business rules are written in design mode (form editor):

form_editor

In order to add new or edit existing rule, you can use one of two ways

1. Select Business Rules option on the top of the form.

business_rules_explorer

This brings up Business Rule Explorer that displays existing business rules that can be opened and edited. And also, there’s an option to add new business rule at the bottom of the page. Opening or creating new rule opens edit window of business rule

2. Double click on the form field that will be part of the business rule, as primary of participating field.

This opens up field properties, and business rules can be found on Business Rules tab.

field_tabs

This list shows existing business rules related to selected field, is it primary or just participating field, and if the rule is activated or deactivated. If the field is in Deactivated status, it is not applied to the form/field until it gets activated. You can activate/deactivate field by selecting it and clicking activate or deactivate buttons. You can open existing rule or create new one with New button on the left top of the form. Opening or creating new rule opens edit window of business rule, just like in the first case described above.

If you are editing existing rule, you have to deactivate it first.

After editing or creating new rule, click Save, and then Activate.

Operation that can be done on business rules are:

business_rule_options

  • new – create new rule
  • edit – change existing rule
  • X (delete) – delete selected rule
  • activate – activate existing rule, it can’t be edited in activated status and it is applied only if it’s activated
  • deactivate – deactivate existing rule, it can be edited if it’s deactivated and it’s not applied until it is deactivated
  • managed properties – define if selected rule will be editable/customizable when it is exported as a part of managed solution.