Business Rules by Form Type

Xrm.Page.ui.getFormType() is used in form script to find out what type of form is currently loaded. Sometimes, we want to apply a certain logic, depending on whether it is a create form or update form. e.g I want to disable some fields, if it is an update form.

If we are using Business Rules, it is not very obvious (at least to me) on how this can be achieved. The answer is quite simple: just check the value of any of these system fields (created, createdon, modifiedby, modifiedon).

Here is a business rule that will trigger only for update form.

Here is the rule for create form.

Here is the result after the rule has run on an existing record

The important thing to remember is: The system field you are checking (in this case createdon), has to be on the form. Otherwise the rule will not fire.

Credits to @BernadoNH for this info.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s