Tuesday, 18 July 2023

Understanding Business Rules in MS Dynamics CRM

 

Scope:

The scope of business rule can be either ‘Entity’ or ’All Forms’. When we select the scope as ‘Entity’, it executes at server side. The business rule fires whenever that entity is created or saved either from the form inside CRM or from any web application.

1

Selecting Entity as Scope

The scope ‘All Forms’ is selected when the business rule is to be executed at client side. In that case, the business rule is fired when the form is loaded or updated only at the client CRM form. Read more here.

Selecting All Forms as Scope

Selecting All Forms as Scope 

Limitations:

  • One of the limitations of business rules is that they are not executed during bulk edits and imports.
  • We can’t debug and trace business rules like we do the JavaScript.
  • The actions that can be performed using business rules are limited compared to the requirements a developer has to meet, like setting a field value by appending two other field values and hence forces them to depend on JavaScript.
  • Also business rules are launched in the order they are activated. So one has to know all the business rules and the order in which they are to be executed in an entity.
  • The number of If…Else statements in a business rule is limited to 10.
  • The execution of a business rule is always enforced. There is no control over their execution. When a JavaScript and business rule acts on the same field of a form, the precedence is for System JavaScript followed by Custom JavaScript and then business rules.
  • A JavaScript cannot be called from a business rule.
  • A business rule can be acted only on the fields of local entities and not on the fields like look up of related entities or parent entities. Also business rules can’t interact with tabs and sections.

Setting Business Rules in MS Dynamics CRM:

To view the Business Rules, you can login to your MS Dynamics CRM page and select the appropriate option (for example Sales> Contact). Then select the entity and click New> Form> and click on Business Rules. You can view all the previously created business rules. Example given below.

3

For creating a new business rule, you can click on the ‘New Business Rule’ option on the bottom right corner of the screen. As illustrated in the first two screenshots, you can follow the instructions given and set the business rules as needed for fulfilling your business purposes.

1 comment:

  1. Number of rules: More than 150 business rules can cause performance degradation.
    Number of actions: Each rule can have up to five actions.
    Number of conditions: Each rule can have up to nine conditions, each with a true/yes and false/no branch

    ReplyDelete

How to Trigger a Microsoft Flow from a Custom Button in Dynamics 365

  When using Microsoft Flow the out-of-the-box button is nested under the ‘Flow’ section and is not easy to find nor is it customizable. Tri...