You can display any number of notifications using “setFormNotification”
and they will be displayed until they are removed using clearFormNotification.
The height of the notification area is limited so each new message will be
added to the top. Users can scroll down to view older messages that have not
yet been removed.
Syntax
To
clear the notifications on the form.
Xrm.Page.ui.clearFormNotification(uniqueId);
To
set the notifications on the form.
Xrm.Page.ui.setFormNotification(message, level, uniqueId);
To set
the notifications on the form for a particular field.
Xrm.Page.getControl(fieldname).setNotification(message, uniqueId);
--------------------------------------------------------------------------------------
To set the notifications on the form.
function setFormNotifications() {
Xrm.Page.ui.setFormNotification("This is an INFORMATION
notification.", "INFO","1");
Xrm.Page.ui.setFormNotification("This is a WARNING notification.
", "WARNING" , "2");
Xrm.Page.ui.setFormNotification("This is an ERROR notification.
", "ERROR", "3");
Xrm.Page.getControl("name").setNotification("Message to
display", "101")
}
To clear the notifications from field and form.
function clearFormNotifications() {
// Cleards
notifications from the field "name" with unique identifier 101
Xrm.Page.getControl("name").clearNotification("101");
// Clears
notifications from the form for unique id 1
Xrm.Page.ui.clearFormNotification("1");
}
No comments:
Post a Comment