clearGlobalNotification (Client API reference)

Clears a notification in the app.

Syntax

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

Parameters

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.

Examples

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"
}

Xrm.App.addGlobalNotification(notification).then(
    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) {
        console.log(error.message);
        // handle error conditions
    }
);

addGlobalNotification