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.

  1. 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

    Form notification

  2. 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");
    }

    Field notification

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!

Comments

Popular posts from this blog

DYNAMICS 365 HOW TO HIDE RECENT RECORDS FOR LOOKUP FIELD IN UCI

SEARCH BY GUID IN DYNAMICS 365

SAVE FORM IN DYNAMICS 365 JAVASCRIPT