Blog Archives

How to set and clear field notification in CRM 2013 using JScript – CRM 2013 Feature

There is a new client API  feature introduced in CRM 2013 – Setting Form and Field level notifications through Jscript.

Let’s have a look at how to set notification on a field on Account form.

The requirement is to check and notify if Phone field on the account form is empty.

Sample Code has been added to OnSave() event of Account:


function AlertOnAccountForm() {

    //Set Field Notification
    if (Xrm.Page.data.entity.attributes.get('telephone1').getValue() == null) {
        Xrm.Page.getControl('telephone1').setNotification('Phone Number should not be empty');
    }

}

And the UI will be like this on save of account form:

Field notification