---
sourceDocument: Yokohama 애플리케이션 빌드 또는 수정
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ko-KR/yokohama/application-development

 Release :

    - yokohama

ft:locale :

    - ko-KR

ft:publication_title :

    - Yokohama 애플리케이션 빌드 또는 수정

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Creator


---

다음을 사용하여 코드에서 애플리케이션 메타데이터 정의 ServiceNow Fluent
===============================================

및 를 사용하여 ServiceNow Fluent 코드에서 애플리케이션 메타데이터 정의 ServiceNow SDK {#ariaid-title1}
===============================================================================

* 릴리스 버전: Yokohama
* 
* 업데이트 날짜 2025년 01월 30일
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 읽기7분

다음을 사용하여 코드에서 애플리케이션 메타데이터 정의 ServiceNow Fluent그리고 .ServiceNow SDK

시작하기 전에
-------

* ServiceNow Fluent 언어 서버를 설치하여 에 Visual Studio Code대한 ServiceNow Fluent 언어 처리 및 유효성 검사를 가져옵니다. 자세한 내용은 [ServiceNow Fluent 에 언어 서버 설치Visual Studio Code](https://servicenow-prod.fluidtopics.net/M_Ix3De9YOli9hQfD5R23A "언어 서버를 사용하여 in Visual Studio Code 에 ServiceNow Fluent 대한 ServiceNow Fluent 언어 처리 및 유효성 검사를 가져옵니다.") 문서를 참조하십시오.
* 를 ServiceNow SDK사용하여 범위가 지정된 애플리케이션을 만들거나 변환합니다. 자세한 내용은 [를 사용하여 애플리케이션 생성 ServiceNow SDK](https://servicenow-prod.fluidtopics.net/K8uTs1BKeFPVW1LTJ79Kbg "범위가 지정된 애플리케이션을 생성하거나 하여 소스 코드에서 ServiceNow SDK개발하십시오.") 또는 .

{#define-metadata-code-fluent-sdk__ul_uk1_dsh_zbc}

필요한 역할: 관리자

이 태스크 정보
--------

ServiceNow Fluent 는 애플리케이션을 구성하는 메타데이터 파일\[sys_metadata\]을 정의하기 위한 TypeScript 기반의 DSL(Domain-Specific Language)이며 테이블, 역할, ACL, 비즈니스 규칙 및 Automated Test Framework 테스트와 같은 다양한 유형의 메타데이터에 대한 API를 포함합니다.
API 및 예제에 대한 ServiceNow Fluent 자세한 내용은 다음 문서를 참조하십시오 [ServiceNow Fluent API 참조](https://servicenow-prod.fluidtopics.net/C~Svw3BWXDFrQE_mwufqpA "API를 사용하여 ServiceNow Fluent 소스 코드에서 ServiceNow IDE 범위가 지정된 애플리케이션을 구성하는 메타데이터를 정의하거나 또는 ServiceNow SDK.").

프로시저
----

1. 에서 Visual Studio Code범위가 지정된 애플리케이션 디렉터리를 엽니다.
2. src/fluent 디렉터리에서 확장명이 .now.ts 파일을 추가합니다.  
   단일 파일 또는 원하는 만큼 .now.ts 파일에 애플리케이션 메타데이터를 정의하고 fluent 디렉터리 내의 디렉터리에 파일을 구성할 수 있습니다.  
   팁:  
   fluent 디렉터리에서 index.now.ts라는 예제 파일을 참조할 수 있습니다.
3. .now.ts 파일에서 API의 ServiceNow Fluent 오브젝트를 사용하여 애플리케이션에서 메타데이터를 정의합니다.  
   예를 들어 애플리케이션에서 테이블 \[sys_db_object\]을 만들려면 테이블 API를 사용합니다. 다음 예제에는 필요한 속성 및 값이 있는 Table 개체를 사용하는 할 일 목록에 대한 간단한 테이블이 포함되어 있습니다.

       export const x_snc_example_to_do = Table({
           name: 'x_snc_example_to_do',
           schema: {
               deadline: DateColumn({ label: 'deadline' }),
               state: StringColumn({
                   label: 'State',
                   choices: {
                       ready: { label: 'Ready' },
                       completed: { label: 'Completed' },
                       in_progress: { label: 'In Progress' },
                   },
               }),
               task: StringColumn({ label: 'Task', maxLength: 120 }),
           },
       })

   주:  
   기록 API를 사용하여 전용 API가 없는 애플리케이션 메타데이터를 정의할 수 있습니다.
4. @servicenow/sdk/core에서 API에 필요한 가져오기를 추가합니다.  
   예를 들어 날짜 열과 문자열 열이 있는 테이블을 정의하려면 Table API에서 사용할 해당 객체를 임포트합니다.

       import { Table, DateColumn, StringColumn } from '@servicenow/sdk/core'

5. **옵션:** 비즈니스 규칙과 같은 서버측 스크립트를 사용하는 API의 경우 ServiceNow Fluent JavaScript 모듈에서 코드를 임포트하여 객체의 스크립트 속성에서 호출합니다.  
   이 예제에서는 `showStateUpdate` 함수를 가져온 다음 스크립트 속성에서 참조할 수 있습니다.

       import { showStateUpdate } from '../server/script.js'

6. 변경 내용을 저장합니다.
7. **옵션:** 애플리케이션을 빌드 및 배포하여 소스 코드를 애플리케이션 메타데이터로 컴파일하고 인스턴스에서 변경 내용을 사용할 수 있도록 합니다. 자세한 내용은 [다음을 사용하여 애플리케이션 빌드 및 배포 ServiceNow SDK](https://servicenow-prod.fluidtopics.net/oeP4wpExkmS~iak~Z0~0Fg "로 ServiceNow SDKServiceNow 개발된 로컬 애플리케이션을 빌드하고 인스턴스에 배포합니다.") 문서를 참조하십시오.
팁:  
코드 주석에 다음 지시문을 사용하면 코드를 관리하는 데 도움이 됩니다.

* `@fluent-ignore`: 다음 코드 줄에서 진단 경고 및 오류를 표시하지 않습니다 ServiceNow Fluent .
* `@fluent-disable-sync`: 개체에 대한 ServiceNow Fluent 변경 내용 동기화를 끕니다. 호출 식 앞(예: `Record({ ... })`)을 사용하여 해당 개체 및 해당 자식 개체에 대한 동기화를 해제합니다. 개체에 대한 소스 코드 외부의 변경 내용을 무시하고 동기화할 때 업데이트하지 않으려는 경우에만 이 지시문을 사용합니다.
* `@fluent-disable-sync-for-file`: 파일에 대한 ServiceNow Fluent 변경 사항 동기화를 끕니다(.now.ts). 파일의 첫 번째 줄에서 파일의 모든 코드에 대한 동기화를 해제하는 데 사용합니다. 파일에 대한 소스 코드 외부의 변경 사항을 무시하고 동기화할 때 업데이트하지 않으려는 경우에만 이 지시문을 사용합니다.
{#define-metadata-code-fluent-sdk__ul_dzm_xxw_ldc}

다음을 사용하여 소스 코드에서 애플리케이션 메타데이터 정의 ServiceNow Fluent {#define-metadata-code-fluent-sdk__example_xdy_q1y_jbc}
----------------------------------------------------------------------------------------------------------

확장명이 .now.ts 인 파일에서 API의 ServiceNow Fluent 개체를 사용하여 애플리케이션에서 메타데이터를 정의합니다. @servicenow/sdk/core에서 API에 필요한 가져오기도 포함해야 합니다.  
다음 예시에는 애플리케이션의 테이블, 클라이언트 스크립트 및 비즈니스 규칙 정의가 포함되어 있습니다. 비즈니스 규칙은 script.js JavaScript 모듈의 함수를 사용합니다.

    import '@servicenow/sdk/global'
    import { BusinessRule } from '@servicenow/sdk/core'
    import { ClientScript } from '@servicenow/sdk/core'
    import { Table, DateColumn, StringColumn } from '@servicenow/sdk/core'
    import { showStateUpdate } from '../server/script.js'

    //creates todo table, with three columns (deadline, status and task)
    export const x_snc_example_to_do = Table({
        name: 'x_snc_example_to_do',
        schema: {
            deadline: DateColumn({ label: 'deadline' }),
            state: StringColumn({
                label: 'State',
                choices: {
                    ready: { label: 'Ready' },
                    completed: { label: 'Completed' },
                    in_progress: { label: 'In Progress' },
                },
            }),
            task: StringColumn({ label: 'Task', maxLength: 120 }),
        },
    })

    //creates a client script that pops up 'Table loaded successfully!!' message everytime todo record is loaded
    ClientScript({
        $id: Now.ID['cs0'],
        name: 'my_client_script',
        table: 'x_snc_example_to_do',
        active: true,
        applies_extended: false,
        global: true,
        ui_type: 'all',
        description: 'Custom client script generated by Now SDK',
        messages: '',
        isolate_script: false,
        type: 'onLoad',
        script: script`function onLoad() {
            g_form.addInfoMessage("Table loaded successfully!!")
        }`,
    })

    //creates a business rule that pops up state change message whenever a todo record is updated
    BusinessRule({
        $id: Now.ID['br0'],
        action: ['update'],
        table: 'x_snc_example_to_do',
        script: showStateUpdate,
        name: 'LogStateChange',
        order: 100,
        when: 'after',
        active: true,
    })

애플리케이션을 빌드하고 배포한 후 이 소스 코드는 인스턴스에 다음과 같은 애플리케이션 메타데이터 파일을 생성합니다.
그림 1. 코드에서 생성된 ServiceNow Fluent 애플리케이션 메타데이터
**관련 개념**   

* [ServiceNow Fluent](https://servicenow-prod.fluidtopics.net/PKtEgkiFMaPHix6id7lUhg "도메인별 프로그래밍 언어를 사용하여 ServiceNow Fluent 소스 코드에서 애플리케이션 메타데이터를 정의합니다.")

