기본 설정 - 범위, 전역

  • 릴리스 버전: Xanadu
  • 업데이트 날짜 2024년 08월 01일
  • 읽기3분
  • 기본 설정 API는 사용자에 대한 알림 대상을 가져옵니다.

    알림 대상은 특정 이메일 주소 또는 전화 번호와 같이 알림을 전달할 수 있는 위치입니다. 이 API는 알림 [sys_notification] 테이블의 알림을 기반으로 합니다. 알림은 이메일 또는 작업 공간와 같은 채널을 통해 전송됩니다. 채널은 여러 유형의 대상에 알림을 보내는 데 사용할 수 있습니다. 예를 들어 이메일 채널은 개인 이메일과 회사 이메일 대상 모두에 알림을 보낼 수 있습니다. 대상 유형은 알림 대상 유형 [sys_notif_destination_type] 테이블에 나열됩니다.

    이 API를 PreferenceDestination API와 함께 사용하여 사용자 알림 환경설정을 업데이트합니다.

    이 클래스는 sn_notification 네임스페이스 식별자를 사용합니다.

    기본 설정 - 기본 설정(GlideRecord 수신자)

    지정된 사용자에 대한 Preferences 개체를 인스턴스화합니다.

    표 1. 매개변수
    이름 유형 설명
    수신자 GlideRecord 알림 대상을 가져오려는 사용자의 사용자 [sys_user] 테이블의 GlideRecord입니다.

    이 예제에서는 사용자 Abel Tuter에 대한 Preferences 객체를 인스턴스화합니다.

    var recipient = new GlideRecord('sys_user'); 
    recipient.get('last_name', 'Tuter'); 
    var prefs = new sn_notification.Preferences(recipient);

    기본 설정 - getDestinations()

    사용자의 알림 대상을 반환합니다.

    표 2. 매개변수
    이름 유형 설명
    없음
    표 3. 반환
    유형 설명
    배열 PreferenceDestination 객체의 배열입니다. 사용자에게 대상이 없는 경우 배열은 비어 있습니다.

    이 예제에서는 Abel Tuter의 모든 알림 대상을 가져옵니다. 출력은 Abel에게 하나의 대상이 있음을 보여줍니다.

    var recipient = new GlideRecord('sys_user'); 
    recipient.get('last_name', 'Tuter'); 
    var prefs = new sn_notification.Preferences(recipient);
    var dests = prefs.getDestinations();
    gs.print(dests);

    출력:

    [object PreferenceDestination]

    기본 설정 - getDestinationsByChannel(GlideRecord 채널)

    지정된 채널을 사용하는 사용자의 알림 대상을 반환합니다.

    표 4. 매개변수
    이름 유형 설명
    채널 GlideRecord 필터링할 채널에 대한 알림 채널 [sys_notification_channel] 테이블의 GlideRecord입니다.
    표 5. 반환
    유형 설명
    배열 PreferenceDestination 객체의 배열입니다. 사용자에게 채널을 사용하는 알림 대상이 없거나 채널이 없는 경우 배열이 비어 있습니다.

    이 예제에서는 Workspace 채널을 사용하는 Abel Tuter의 모든 대상을 가져옵니다. 출력은 Abel에게 Workspace 채널을 사용하는 하나의 대상이 있음을 보여줍니다.

    var recipient = new GlideRecord('sys_user'); 
    recipient.get('last_name', 'Tuter'); 
    var prefs = new sn_notification.Preferences(recipient);
    var channel = new GlideRecord('sys_notification_channel');
    channel.get('name', 'Workspace'); 
    var dests = prefs.getDestinationsByChannel(channel);
    gs.print(dests);

    출력:

    [object PreferenceDestination]