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

Advertisements

About Dynamics CRM Guru

We are a group of CRM Consultants and have rich experience in all Microsoft CRM versions. Currently we provide training in Microsoft CRM 2015/CRM 2013 and CRM 2011.

Posted on March 9, 2016, in JScript, Microsoft CRM 2013, Microsoft CRM 2015, Microsoft Dynamics and tagged , , . Bookmark the permalink. Leave a comment.

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

%d bloggers like this: