{Dynamics 365 Enhancements} Add Notification Recommendations to your Entity forms using script

This blog is part of the series which I will use to cover all interesting enhancements coming in Dynamics 365.

Scenario: On Account form, if user fills in the Telephone field – suggest a recommendation to set Contact preference by Phone field. If user selects yes, set Contact by Phone option to allow.

Scenario by Graphics:

· On change of phone field, CRM shows a recommendation tooltip:


· When you click the information icon, CRM gives you a recommendation:


· If you pick Apply, CRM will do the updating to the field as required:


Great isn’t it?

Here is the link describing the new Client side scripting function: https://msdn.microsoft.com/en-us/library/gg334266.aspx#BKMK_addnotification

And here is the script for this one (Register it on change event of Phone field):

function addPhonePreferenceNotification() {

var myControl = Xrm.Page.getControl(‘telephone1’);

var telephone= Xrm.Page.data.entity.attributes.get(‘telephone1’);

var phonePreference = Xrm.Page.data.entity.attributes.get(‘donotphone’).getValue();

if (telephone.getValue() != null) {

var actionCollection = {

message: ‘Set the Contact Preference for Phone to Allow?’,

actions: null


actionCollection.actions = [function () {





messages: [‘Set Phone Preference’],

notificationLevel: ‘RECOMMENDATION’,

uniqueId: ‘my_unique_id’,

actions: [actionCollection]




console.log(“Notification not set”);

}// JavaScript source code

Hope it helps and Happy CRMing!

Check this out



Twitter: https://twitter.com/msdynamicsblog
LinkedIn: https://www.linkedin.com/in/deepesh-somani-00296932

Google Play Store:



2 thoughts on “{Dynamics 365 Enhancements} Add Notification Recommendations to your Entity forms using script

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