Apply Field Validations without Writing JavaScript in MS CRM 2013 - Part 2

In our last post we discussed business rules and in this post we are going to show how we can create business rule in MS CRM 2013. To create business rule navigating to entity customization. Let's take a very simple example we want to validate if Relationship type is selected a “Consultant” we need to make industry field business required in account entity. If we need to implement this in JS code we need logic like below:

if Relationship type value is consultant then
make Industry field required
else
Remove required from Industry field

In the same way we need to create two business rules for this, one to handle if part and other to handle else part, so let's design our business rule for this.

  • Navigate to account entity customization and select business rule from left navigation.
  • Provide label “Make Industry required”
  • Add a condition using below settings:

Field: Relationship Type

Operator: Equals

Type: Value

Value: Consultant

  • Click on “Check Mark” to collapse condition section.
  • Add action using below settings.

Field: Industry'

Status: Business Required

Click on “Check Mark” to collapse action section.

Set scope for your business rule.

Save and close business rule.

Activate your business rule.

Let's test our business rule navigate to Account entity and create new account and set Relationship type as “Consultant” it will make industry field required like below:

CONSULTANTREQURED

But if you will select some other value in Relationship type it will still keep industry field required like below:

stillrequired

To handle this we need to create another business rule to remove business required in case relationship value is different than consultant. Create new business rule using below configuration:

Notrequired

Activate your second business rule and open account record. Now when you will select some other value it will remove business required from industry field.

Previous Blog: Apply Field Validations without Writing Java Script in MS CRM 2013: Part 1

Ebook Download
View all
Learn
View all