Kongsi melalui


clearGlobalNotification (Rujukan API Klien)

Mengosongkan pemberitahuan dalam apl.

Sintaks

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

Parameter

Nama Jenis Wajib Description
uniqueId String Ya ID yang akan digunakan untuk mengosongkan pemberitahuan tertentu yang ditetapkan menggunakan addGlobalNotification.
successCallback Function No Fungsi untuk memanggil apabila pemberitahuan dibersihkan.
errorCallback Function No Fungsi untuk memanggil apabila operasi gagal.

Nilai Pulangan

Apabila berjaya, mengembalikan objek janji.

Contoh

Contoh berikut menunjukkan cara menambah pemberitahuan dan kemudian menutupnya secara automatik selepas 5 saat.

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