CRM 2016 #Notifications #JavaScript #CRM2016 #MoussaElAnnan #Xrm
//Display a message near the control to indicate that data isn’t valid. When this method is used on Microsoft Dynamics CRM for tablets a red "X" icon appears next to the control. Tapping on the icon will display the message.
Xrm.Page.getControl(arg).setNotification(message,uniqueId);
//Remove a message already displayed for a control.
Xrm.Page.getControl(arg).clearNotification(uniqueId);
/*
* Function that adds a notification.
* @param {string} notificationMessage The notification message.
* @param {string} notificationLevel The notification level.
* @param {string} notificationsId The notification id.
*/
addNotification = function(notificationMessage, notificationLevel, notificationsId){
Xrm.Page.ui.setFormNotification(notificationMessage, notificationLevel, notificationsId);
}
/*
* Function that clears the notification after 5 seconds.
* @param {string} notificationsId The notification id.
*/
clearNotifications = function (notificationsId) {
setTimeout(function () {
Xrm.Page.ui.clearFormNotification(notificationsId);
}, 5000);
}