Business Rules in CRM

What are Business Rules?

–          In CRM 2013, the Business Rules are introduced to allow end users to apply basic form logic without writing JavaScript in CRM

–          It provides simple declarative interface to implement

What things are possible using Business Rules?

–          Hide/Show fields on the form

–          Set field values

–          Enable/Disable fields

–          Set field requirements

–          Validate data and show error messages

4 ways to configure Business Rules

–          Solution -> Entity -> Business Rules


–          Solution -> Entity -> Field


–          Form Editor


–          Form Editor -> Field (Field Properties) -> Business Rules


How Business Rules work?

–          Business rules are applied based on the scope of the business rules selected during creation. Only activated business rules will be applied on the respective entity forms.

–          By default the scope is set to All Forms. To make the business rule available to specific form, you need to change the scope of the business rule.


–          In below order the logic is applied to the form field:

1. System Scripts

2. Custom JavaScript

3. Business Rules

Note: If there are multiple Business Rules applied on single field, then the rule in the order in which rules are activated. Hence if you want any business rule to be applied first, then you need to activate that rule at the last.

How to edit existing Business Rule?

To edit existing Business Rule, first deactivate the rule and then edit. To apply the updated logic, you will need to activate the rule again.


–          Allows end user/ CRM customizer to apply logic quickly without writing any code

–          Enabling and Disabling of logic is simple

–          Easy to test the written logic by Preview option on the Form


–          No complex logic is supported.

–          Business Rules does not run on Form Save event. They only run on Form Load and Field Changes.

–          Custom JavaScript event on the ‘OnChange’ event of field will not work if you set field value using Business Rules.

–          The rule will not run if the field mentioned in the rule is not available on the form. It will not throw an error. Hence user will not come to know about the error.

–          Business Rules does not work on Tabs/Sections/Sub Grids etc.

–          Does not allow else condition. Hence to apply If Else logic, you need to create separate business rules for each condition.

–          Only AND logic can be applied in the Business Rule. No OR logic.

How to setup logic in Business Rules?

Business Rules are divided into 3 sections:

–          Conditions

a. Conditions can be checked on fields only

b. Below operators are available


–          Actions

Actions are the tasks that can be performed by the Business Rules. Actions will be performed only if all conditions are true.

o   Show error message: Used to show any custom error message on any field based on the condition. This does not allow the form to save.

o   Set field value: Allows to set value to any field.

o   Set Business Required: Allows to set any field either required or not required.

o   Set visibility: Allows to show/hide the field.

o   Lock or Unlock field: Allows to make field read-only or editable.

–          Description (Optional)

Gives description of Business Rule. This is optional and does not appear anywhere else.


–          Assumptions:

I have custom entity named “Business Rules Demo” with below fields:

– Field 1 – Two Options

– Field 2 – Option Set { A, B, C, D }

– Field 3 – Single Line of Text

– Field 4 – Single Line of Text

– Field 5 – Single Line of Text

  1. If Field 1 = True


Hide Field 3

Make Field 4 Required

Set Field 5 to ‘Hello’

Disable Field 2

Show error message on Field 1 as ‘Field 3 is hidden’


Show Field 3

Make Field 4 not required

Set Field 5 to ‘Bye’

Enable Field 2

For this, we need to create 2 business rules; 1 for If part and other for Else part as below:



Note: To copy the business rule, open business rule and use ‘Save As’ option. This will create copy of the business rule.

Custom error message will be shown as below:


  1. To check if any field is blank or not, use Contains Data and Does Not Contain Data operator in the condition.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s