Ever been in a situation where you need to write a JavaScript code to show/hide, Enable/Disable or set certain field on the form, am sure there were a lot. The dev’s at Microsoft eased up this task by introducing the concept of Business Rules, but did you ever wondered what if all this needs to be done based on the form type?

Let’s say you want to show certain field if the FormType is Create or Update, unfortunately the first thing that will come to mind is that this cannot be achieved using Business Rules.

Today I’m going to show you a little/neat trick which will allow you to do this without writing a single piece of JavaScript code.

Business Rule for Create Form

Every entity has record creation date i.e. createdon. If this field does not contain any data then that means the record has not yet been created thus the Create Form is active. This is how the Business Rule for Create form will look like
Business Rule for Create and Update FormBusiness Rule for Create and Update Form

Business Rule for Update Form

Similar to what we did for the Create Form, we need to check if the createdon contains data then perform the action, this would essentially mean that it is an Update Form. You can combine the two (Create and Update) into a single business rule like the way I have done it (see screenshot above).

Important Note

It is absolutely essential that the field we choose to check for FormType (Created on in our case) should be present on the form. You can set field visibility to false and lock it.

The post FormType based Business Rules in CRM 2015 appeared first on CRM ParkingLot.