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

In Microsoft Development Forums many times we found posts where new CRM users are asking for help to write JavaScript validation specially if they are not developers, so I hope they will be happy with “Business Rule”, another great feature that is introduced in MS CRM 2013. Business rules helps CRM user to design most frequently used data validations from CRM UI. Business rules provide different functionality like below:

  • Set field value – We can configure business rule to set some field value or use formula to set some calculated value, but you need to keep in mind that if you are setting some field value using business rule it's onchange event is not going to fire :).
  •  Set business requirement – We can define business rule to set business requirement level, we can configure condition where we can define, if we want to compare field with some other field or some value to validate our condition.
  •  Show or hide fields – We have option to hide/show field using business rule, but make sure business rules only works with fields, so you can't use them to hide sections or tab. Also if the field which is used in business rule is not present on a form, the rule won't fire.
  •  Enable or disable fields – This is the mostly used requirement in CRM entity forms, so now you can easily set business rule to enable/disable field.
  •  Show custom error notification- Another most wanted feature added to show custom error notification we will be doing another post for this feature. You can show custom error notification if validations fails. You can also localize your custom notification if you are using multiple language in your organization, you can simply export translations and can it to define your localized custom message.

 So finally, although business rule is an efficient to apply validation over entity form but you should not consider it a complete replacement for JS script because, you can only use current entity field in condition, you don't have option to get field from other entity and put your validation based on that, so if you have business need where you need to compare data from related entity you still need to use Java Script code.

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

Ebook Download
View all
Learn
View all