Understanding Business Rules in Microsoft Dynamics CRM 2013

What are Business Rules?

Microsoft introduced Business Rules with the release of Microsoft Dynamics CRM 2013. The main objective of releasing this functionality is to enable Business Analysts and Power Users to customize Dynamics CRM entity forms and perform actions without writing client-side code (JavaScript).

Business Rules can be configured using the interface and in the backend Dynamics CRM automatically generates the client-script to perform the configured actions. The automatically generated code is not available to the users so from a user’s perspective it only involves configurations.

Capabilities of Business Rules

As mentioned above, the business rules are used to perform actions on the client-side only. The actions that can be performed are listed below.

Action Description
Show error message This action displays an error message if the specified condition is not met. For example, if the data entered in a field does not meet certain validation criteria then the Business Rule can be configured to display an error message to the user and restrict them from saving invalid data in CRM.
Set field value This action is used to set a field’s value based on a condition. For example, if the Country is selected as “Canada” then the country’s dialling code would be auto-populated; or if a field’s data needs to be blanked out because of a specific condition.
Set business required This action is used to change the requirement level of a field dynamically based on a condition. In other words, by consuming this action the mandatory field can be marked as non-mandatory and vice versa.
Set visibility This action is used to hide and show fields on entity forms. This action enables power users or customizers to change the visibility of the fields dynamically based on a specified condition.
Lock or unlock field This action is used to lock or unlock (enable or disable) fields dynamically. Unlocked or Enabled fields are editable and Locked and Disabled fields are read-only.

Business Scenario

Microsoft Dynamics CRM 2013 has following three fields on the Account entity form:

  • Industry
  • Shipping Method
  • Freight Terms

Consider a business scenario where there is a requirement to hide/show “Shipping Method” and “Freight Terms” fields based on the “Industry” the Account belongs to.

The requirement is to:

  • Hide Shipping Method and Freight Terms if the Industry is set to “Consulting”
  • Show Shipping Method and Freight Terms if the Industry is not set to “Consulting”

CRM-business-rules-1

Step-by-step guide to creating Business Rules

Step 1: Click on “Settings”

CRM-business-rules-2

Step 2: Click “Customizations” -> “Customize the System”

CRM-business-rules-3

Step 3: Click Account -> Business Rules -> New to create a new Business Rule, as shown in the figure below.

CRM-business-rules-4

Step 4: Specify the name for the new Business Rule

CRM-business-rules-5

Step 5: Create a new condition – if Industry is set to “Consulting”

CRM-business-rules-6

Step 6: Now click the plus sign (+) to add an Action

CRM-business-rules-7

Step 7: Select the action “Set Visibility”

CRM-business-rules-8

Step 8: Set the Actions to hide “Address 1: Shipping Method” and “Address 1: Freight Terms”

CRM-business-rules-9

Step 9: Save the Business Rule

CRM-business-rules-10

Step 10: Activate the Business Rule

CRM-business-rules-11

Step 11: Create a new Business Rule to show fields

CRM-business-rules-12

Step 12: Create a condition as shown below – where industry is NOT EQUAL to Consulting

CRM-business-rules-13

Step 13: Select “Set visibility” action

CRM-business-rules-14

Step 14: Create actions as shown below

CRM-business-rules-15

CRM-business-rules-16

Step 15: Click “Save” to save the newly created Business Rule 

CRM-business-rules-17

Step 16: Activate the Business Rule 

CRM-business-rules-18

Step 17: Publish All Customizations

CRM-business-rules-19

Step 18: Verify the newly configured Business Rule

CRM-business-rules-20

Congratulations, you have now created Business Rules in Dynamics CRM!

July 9, 2014