clearGlobalNotification (Client API reference)

Clears a notification in the app.


Xrm.App.clearGlobalNotification(uniqueId).then(successCallback, errorCallback);


Name Type Required Description
uniqueId String Yes The ID to use to clear a specific notification that was set using addGlobalNotification.
successCallback Function No

A function to call when the notification is cleared.

errorCallback Function No A function to call when the operation fails.

Return Value

On success, returns a promise object.


The following example shows how to add a notification and then close it automatically after 5 seconds.

// define notification object
var notification = 
  type: 2,
  level: 3, //warning
  message: "Test warning notification"

    function success(result) {
        console.log("Notification created with ID: " + result);

    // Wait for 5 seconds and then clear the notification
    window.setTimeout(function () { 
            Xrm.App.clearGlobalNotification(result); }, 5000);
    function (error) {
        // handle error conditions

See also