---
sourceDocument: オーストラリア API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/api-reference

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリア API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# ServiceNow Fluent

# ServiceNow Fluent {#ariaid-title1}

* リリースバージョン: Australia
* 
* 更新日 2026年03月12日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：6分

ServiceNow Fluent ドメイン固有のプログラミング言語を使用して、ソースコードでアプリケーションメタデータを定義します。

## ServiceNow Fluent の概要 {#servicenow-fluent__section_jnb_vvg_z1c}

ServiceNow Fluent は、アプリケーションを構成するメタデータファイル \[sys_metadata\] を定義するための TypeScript に基づく宣言型ドメイン固有言語 (DSL) であり、テーブル、ロール、ACL、ビジネスルール、 自動テストフレームワーク (ATF) テストなど、さまざまなタイプのメタデータの API が含まれています。

開発者は、フォームやビルダーツールのユーザーインターフェイスではなく、数行のコードでこのメタデータを定義します。ServiceNow IDE または ServiceNow SDK で作成または変換されたアプリケーションは、ServiceNow Fluent での開発をサポートします。

ServiceNow Fluent は双方向同期をサポートしています。これにより、メタデータへの変更を他の ServiceNow AI Platform ユーザーインターフェイスからソースコードに同期し、ソースコードへの変更をインスタンス全体のメタデータに同期することができます。

ServiceNow IDE または ServiceNow SDK の使用を開始するには、『[ServiceNow IDE](https://www.servicenow.com/docs/access?context=servicenow-ide-landing&version=australia&pubname=australia-application-development&ft:locale=en-US)』または『[ServiceNow SDK](https://www.servicenow.com/docs/access?context=servicenow-sdk-landing&version=australia&pubname=australia-application-development&ft:locale=en-US)』のドキュメントを参照してください。

## ServiceNow Fluent 個の API {#servicenow-fluent__section_nyj_y13_zbc}

ServiceNow Fluent には、多くのタイプのメタデータの API が含まれています。レコード API を使用して、専用 API を持たないアプリケーションメタデータを定義できます。サポートされている API と例の最新のリストについては、GitHub の [ServiceNow Fluent API リファレンス](https://servicenow.github.io/sdk/)と [ServiceNow SDK のサンプルリポジトリ](https://github.com/ServiceNow/sdk-examples)を参照してください。  
注:  
メタデータスナップショット \[sys_metadata_link\] や UX 資産 \[sys_ux_lib_asset\] など、限られた数のメタデータタイプは、 ServiceNow Fluent コードとして表すことができず、変換されません。これらのメタデータタイプは、アプリケーションの メタデータ ディレクトリにメタデータ XML ファイルとして残ります。

## ServiceNow Fluent の使用法 {#servicenow-fluent__section_dgj_1b3_zbc}

拡張子が .now.ts のファイルで、ServiceNow Fluent API のオブジェクトを使用して、アプリケーションのメタデータを定義します。また、@servicenow/sdk/core からの API に、必要なインポートも含める必要があります。BusinessRule オブジェクトなどのサーバー側スクリプトを持つオブジェクトの場合は、JavaScript モジュールからコードをインポートして使用できます。  
次の例には、アプリケーションのテーブル、クライアントスクリプト、およびビジネスルールの定義が含まれています。クライアントスクリプトは、client-script.jsファイルのスクリプトを使用します。ビジネスルールは、script.js JavaScript モジュールの関数を使用します。

    import '@servicenow/sdk/global'
    import { BusinessRule, ClientScript, DateColumn, StringColumn, Table } 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' },
                    inProgress: { 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,
        appliesExtended: false,
        global: true,
        uiType: 'all',
        description: 'Custom client script generated by Now SDK',
        isolateScript: false,
        type: 'onLoad',
        script: Now.include('../client/client-script.js'),
    })

    //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,
    })

ClientScript オブジェクトから参照されるクライアントスクリプト:

    function onLoad() {
        g_form.addInfoMessage("Table loaded successfully!!")
    }

BusinessRule オブジェクトから参照される JavaScript モジュール:

    import { gs } from '@servicenow/glide'

    export function showStateUpdate(current, previous) { 
        const currentState = current.getValue('state')
        const previousState = previous.getValue('state')

        gs.addInfoMessage(`state updated from "${previousState}" to "${currentState}"`)
    }

アプリケーションのビルド後、このソースコードはインスタンスで次のアプリケーションメタデータファイルを生成します。
図 : 1. ServiceNow Fluent コードから生成されたアプリケーションメタデータ  
ヒント:  
コードコメントで次のディレクティブを使用して、コードを管理できます。

* `@fluent-ignore`：次のコード行の ServiceNow Fluent 診断警告とエラーを抑制します。
* `@fluent-disable-sync`：ServiceNow Fluent オブジェクトへの変更の同期をオフにします。呼び出し式の前 (`たとえば、Record({ ... })`) を使用して、そのオブジェクトと子オブジェクトの同期をオフにします。このディレクティブは、ソースコードの外部でオブジェクトに加えられた変更を無視し、同期時に更新しない場合にのみ使用します。
* `@fluent-disable-sync-for-file`：ServiceNow Fluent ファイル (.now.ts) への変更の同期をオフにします。ファイル内のすべてのコードの同期をオフにするには、ファイルの最初の行で使用します。このディレクティブは、ソースコードの外部でファイルに加えられた変更を無視し、同期時に更新しない場合にのみ使用します。
{#servicenow-fluent__ul_dzm_xxw_ldc}
**関連情報**   

* [ServiceNow Fluent API reference](https://www.servicenow.com/docs/access?context=servicenow-fluent-api-reference&version=australia&pubname=australia-application-development&ft:locale=en-US)
* [Define application metadata in code with ServiceNow Fluent in the ServiceNow IDE](https://www.servicenow.com/docs/access?context=define-metadata-code-fluent-ide&version=australia&pubname=australia-application-development&ft:locale=en-US)
* [Define application metadata in code with ServiceNow Fluent and the ServiceNow SDK](https://www.servicenow.com/docs/access?context=define-metadata-code-fluent-sdk&version=australia&pubname=australia-application-development&ft:locale=en-US)

