DYNAMICS 365 FORM NOTIFICATION AND FIELD NOTIFICATION
In a previous post, we saw
how to display a global notification that lives across the Model driven App
.
In Dynamics 365 form, you can display two types of notifications: Form Notifications and Field Notifications.
In this article, we will see how to display Form Notifications and Field Notifications within an entity form using JavaScript.
-
The form notification will be displayed on top of the form and the setFormNotification function is used to display form level notifications
function displayFormNotification(context) {
var formContext = context.getFormContext();
formContext.ui.setFormNotification("This is an INFORMATION form notification.", "INFO", "InformationNotificationId");
formContext.ui.setFormNotification("This is a WARNING form notification.", "WARNING", "WarningNotificationId");
formContext.ui.setFormNotification("This is an ERROR form notification.", "ERROR", "ErrorNotificationId");
}
We have three level of form notification:- INFO: It displays information notification message to the user with system info icon
- WARNING: It displays warning notification message to the user with system warning icon
- ERROR: It displays error notification message to the user with system warning icon
-
The field notification will be displayed on the field and the setNotification function is used to display field level notifications
function displayFieldNotification(context) {
var formContext = context.getFormContext();
formContext.getControl("name").setNotification("This is a field message notification.", "FieldNotificationId");
}
Bonus Tips:
- To remove form notification, you have to use the function clearFormNotification function formContext.ui.clearFormNotification("uniqueId"); with the Notification Id you want to remove
- To remove field notification, you have to use the function clearNotification function formContext.getControl("fieldLogicalName").clearNotification("uniqueId"); with the Notification Id you want to remove
Hope This Helps!
Hey, do you know a way to prevent the notifications from collapsing so all of them are visible without having to click it?
ReplyDeleteHello, unfortunately it is not possible to do this.
Delete