clearGlobalNotification (Tài liệu tham khảo về API máy khách)

Xóa thông báo trong ứng dụng.

Cú pháp

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

Tham số

Tên Kiểu Bắt buộc Sự miêu tả
uniqueId String ID để sử dụng để xóa thông báo cụ thể đã được đặt bằng addGlobalNotification.
successCallback Hàm Không Chức năng gọi khi thông báo bị xóa.
errorCallback Hàm Không Một hàm để gọi khi hoạt động không thành công.

Trả về giá trị

Khi thành công, trả về một đối tượng promise.

Ví dụ

Ví dụ sau đây cho thấy cách thêm thông báo, rồi đóng thông báo tự động sau 5 giây.

// 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