기록 API - ServiceNow Fluent

  • 릴리스 버전: Zurich
  • 업데이트 날짜 2025년 07월 31일
  • 소요 시간: 3분
  • 기록 API는 모든 테이블의 기록을 정의합니다. 기록 API를 사용하여 전용 ServiceNow Fluent API가 없는 애플리케이션 메타데이터를 정의합니다.

    기록 객체

    기록이 있는 테이블에 데이터를 추가합니다.

    표 1. 속성
    이름 유형 설명
    $id 문자열 또는 숫자 필수 메타데이터 객체의 고유 ID입니다. 애플리케이션을 빌드할 때 이 ID는 고유한 sys_id으로 해시됩니다. 자세한 내용은 ServiceNow Fluent 언어 구성 문서를 참조하십시오.

    형식: Now.ID['문자열' 또는 숫자]

    테이블 문자열 필수 기록이 속한 테이블의 이름입니다.
    데이터 객체 테이블의 필드와 해당 값입니다. 예:
    data: {
       state: 'Ready',
       task: 'Add demo data'
    }
    다른 파일의 텍스트 컨텐츠를 사용하려면 Now.include 구문을 사용하여 애플리케이션의 파일을 참조하십시오. 자세한 내용은 ServiceNow Fluent 언어 구성 문서를 참조하십시오.
    data: {
       script: Now.include('./script-file.js'),
       html: Now.include('./html-file.html'),
       css: Now.include('./css-file.css')
     }
    $meta 객체 애플리케이션 메타데이터의 메타데이터입니다.
    installMethod 속성을 사용하면 애플리케이션 메타데이터를 특정 상황에서만 로드되는 출력 디렉터리에 매핑할 수 있습니다.
    $meta: {
          installMethod: 'String'
    }
    installMethod에 유효한 값:
    • demo: 데모 데이터 로드 옵션을 선택한 경우 애플리케이션과 함께 설치할 metadata/unload.demo 디렉터리에 애플리케이션 메타데이터를 출력합니다.
    • 첫 번째 설치: 애플리케이션이 인스턴스에 처음 설치될 때만 설치할 메타데이터 /언로드 디렉터리에 애플리케이션 메타데이터를 출력합니다.
    이 예에서는 메뉴 범주를 정의하는 기록이 메뉴 범주 [sys_app_category] 테이블에 추가됩니다. 메뉴 범주 스타일은 css-file.css 파일에 정의되어 있습니다.
    import { Record } from "@servicenow/sdk/core";
    
    export const appCategory = Record({
       table: 'sys_app_category',
       $id: Now.ID[9],
       data: {
          name: 'example',
          style: Now.include('./css-file.css'),
       },
    })
    이 예에서는 인시던트를 정의하는 기록이 인시던트 [incident] 테이블에 추가됩니다.
    import { Record } from '@servicenow/sdk/core';
    
    export const incident1 = Record({
      $id: Now.ID['incident-1'],
      table: 'incident',
      data: {
        active: 'true',
        approval: 'not requested',
        description: 'Unable to send or receive emails.',
        incidentState: '1',
        shortDescription: 'Email server is down.',
        subcategory: 'email',
        callerId: '77ad8176731313005754660c4cf6a7de',
      }
    })
    이 예시에서는 서버를 정의하는 레코드가 서버 [cmdb_ci_server] 테이블에 추가됩니다.
    import { Record } from '@servicenow/sdk/core';
    
    export const ciserver1 = Record({
      $id: Now.ID['cmdb-ci-server-1'],
      table: 'cmdb_ci_server',
      data: {
        assetTag: 'P1000199',
        attested: 'false',
        canPrint: 'false',
        company: 'e7c1f3d53790200044e0bfc8bcbe5deb',
        cost: '2160',
        costCc: 'USD',
        cpuSpeed: '633',
        cpuType: 'GenuineIntel',
        diskSpace: '100',
        manufacturer: 'b7e7d7d8c0a8016900a5d7f291acce5c',
        name: 'DatabaseServer1',
        os: 'Linux Red Hat',
        shortDescription: 'DB Server',
        subcategory: 'Computer',
      }
    })