다음을 통해 공유


clearGlobalNotification(클라이언트 API 참조)

앱에서 알림을 지웁니다.

Syntax

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

매개 변수

이름 유형 필수 Description
uniqueId String Yes addGlobalNotification을 사용하여 설정된 특정 알림을 지우는 데 사용할 ID입니다.
successCallback 기능 아니오 알림이 지워지면 호출할 함수입니다.
errorCallback 기능 아니오 작업이 실패할 때 호출하는 함수입니다.

반환 값

성공하면 promise 개체를 반환합니다.

예시

다음 예제에서는 알림을 추가한 다음 5초 후에 자동으로 닫는 방법을 보여줍니다.

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