clearGlobalNotification (Referensi API Klien)

Menghapus pemberitahuan di aplikasi.

Syntax

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

Parameter-parameternya

Nama Tipe Diperlukan Description
uniqueId String Yes ID yang digunakan untuk menghapus pemberitahuan tertentu yang diatur menggunakan addGlobalNotification.
successCallback Function Tidak. Fungsi untuk memanggil saat pemberitahuan dibersihkan.
errorCallback Function Tidak. Fungsi untuk memanggil saat operasi gagal.

Mengembalikan Nilai

Setelah berhasil, mengembalikan objek janji.

Examples

Contoh berikut menunjukkan cara menambahkan pemberitahuan lalu menutupnya secara otomatis setelah 5 detik.

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