> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-fix-ss-log-app-metadata-user-metadata-clarification.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 変数とヘルパー関数

> アクション用のフォームで変数を使用する方法を説明します。

変数を使用すると、フォームとフローに含まれるデータにアクセスして、カスタムビジネスロジックと自動化を作成できます。

変数を使用する際の基本的な考慮事項は次のとおりです。

* 変数は中括弧`{{ variable }}`で囲みます。
* 変数が存在しないか解決できない場合は、`未定義`の変数と同じ効果があります。
* `null`または`未定義`の変数を処理するには、nullish演算子を使用できます。例:`{{fields.foo ?? fields.bar}}`。

## 利用できる変数

フォームとフローを使用して顧客から収集したデータを参照および変換するには、さまざまな種類の変数を使用できます。

| 変数                              | 構文                | 場所       | 説明                             |
| ------------------------------- | ----------------- | -------- | ------------------------------ |
| Context（コンテキスト）                 | `{{context.*}}`   | フォーム/フロー | 現在のトランザクションのリファレンスコンテキストデータ    |
| Form fields（フォームフィールド）          | `{{fields.*}}`    | フォーム/フロー | フォームフィールドと非表示フィールドからのリファレンスデータ |
| Shared variables（共有変数）          | `{{vars.*}}`      | フォーム/フロー | 共有変数として保存されたリファレンスデータ          |
| Flow actions output（フローアクション出力） | `{{actions.*}}`   | フロー      | 前のフローアクションの出力応答からのリファレンスデータ    |
| Helper functions（ヘルパー関数）        | `{{functions.*}}` | フォーム/フロー | データ変換のためのヘルパー関数                |

### コンテキスト変数

フォームとフローは、現在のトランザクションからコンテキスト変数を自動的に継承します。次のコンテキスト変数にアクセスできます。

* `user`オブジェクト。以下に挙げたプロパティにアクセスできます。

  * `user.user_id`
  * `user.username`
  * `user.name`
  * `user.given_name`
  * `user.family_name`
  * `user.nickname`
  * `user.email`
  * `user.email_verified`
  * `user.phone_number`
  * `user.phone_verified`
  * `user.picture`
  * `user.user_metadata`
  * `user.app_metadata`
  * `user.created_at`
  * `user.updated_at`
  * `user.last_password_reset`
  * `user.identities`
* 次のプロパティにアクセスできる`組織`オブジェクト。

  * `organization.id`
  * `organization.name`
  * `organization.display_name`
  * `organization.metadata`
* 次のプロパティにアクセスできる`クライアント`オブジェクト。

  * `client.client_id`
  * `client.name`
* 次のプロパティにアクセスできる`テナント`オブジェクト。

  * `tenant.name`
* 次のプロパティにアクセスできる`トランザクション`オブジェクト。

  * `transaction.state`

<Accordion title="コンテキストオブジェクトの例">
  ```json lines expandable theme={null}
  {
    "user": {
      "user_id": "auth0|658409...",
      "name": "ana@travel0.com",
      "nickname": "ana",
      "email": "ana@travel0.com",
      "email_verified": true,
      "picture": "https://s.gravatar.com/avatar/8eb1b522f6...",
      "user_metadata": {},
      "app_metadata": {},
      "created_at": "2023-12-21T09:46:40.487Z",
      "updated_at": "2024-05-07T10:44:26.271Z",
      "last_password_reset": "2023-12-21T09:49:08.932Z",
      "identities": [
        {
          "user_id": "6584...",
          "isSocial": false,
          "provider": "auth0",
          "connection": "Username-Password-Authentication"
        }
      ]
    },
    "client": {
      "client_id": "xpeg5...",
      "name": "My App"
    },
    "tenant": {
      "name": "tenant-testing"
    },
    "transaction": {
      "state": "hKFo2SBId2M0..."
    }
  }
  ```
</Accordion>

例：  `{{context.user.user_id}}`は、`ユーザー`オブジェクトの`user_id`を参照します。

<Frame>
  <img src="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3B8DRhXO2wGqeqSFb8KbQv/0a61cdbbb7f1d290950a2ddb9857aac3/Contex-variable.png?fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=806a4401393ec2b3fa72e4ae73cfee6c" alt="Dashboard > Forms > Flows" data-og-width="1141" width="1141" data-og-height="219" height="219" data-path="docs/images/ja-jp/cdy7uua7fh8z/3B8DRhXO2wGqeqSFb8KbQv/0a61cdbbb7f1d290950a2ddb9857aac3/Contex-variable.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3B8DRhXO2wGqeqSFb8KbQv/0a61cdbbb7f1d290950a2ddb9857aac3/Contex-variable.png?w=280&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=704c80d0c3ef7427cd6f4bcd9d893922 280w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3B8DRhXO2wGqeqSFb8KbQv/0a61cdbbb7f1d290950a2ddb9857aac3/Contex-variable.png?w=560&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=76e7a5dd0c41dda273376a930a0537a3 560w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3B8DRhXO2wGqeqSFb8KbQv/0a61cdbbb7f1d290950a2ddb9857aac3/Contex-variable.png?w=840&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=3ef02d94d91a78d0e5aeefbbffb792ae 840w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3B8DRhXO2wGqeqSFb8KbQv/0a61cdbbb7f1d290950a2ddb9857aac3/Contex-variable.png?w=1100&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=568b0b65f0a16e5b130ca8cb358c3350 1100w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3B8DRhXO2wGqeqSFb8KbQv/0a61cdbbb7f1d290950a2ddb9857aac3/Contex-variable.png?w=1650&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=1670096f2075b2a7a91bc5f004a4dc60 1650w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3B8DRhXO2wGqeqSFb8KbQv/0a61cdbbb7f1d290950a2ddb9857aac3/Contex-variable.png?w=2500&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=fa2bd4509fae6861813094e5bd59ce81 2500w" />
</Frame>

### フォームフィールド変数

フィールド変数には、フォームの入力フィールドからユーザーから収集されたデータと、非表示フィールドのデータが含まれます。各フィールドのデータは、フィールドタイプによって異なります。例：`{{fields.first_name`}}は、IDが`first_name`のフィールドの入力値を参照します。

<Frame>
  <img src="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4D42A6ww4XvFxweoxh04Rd/016c2ed9d25bc2267ed3ed31bf8b2bf6/form-fields-variable.png?fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=faedfb97a3a13e0fcd962c38ff4d1a66" alt="Dashboard > Actions > Forms > Form" data-og-width="1404" width="1404" data-og-height="497" height="497" data-path="docs/images/ja-jp/cdy7uua7fh8z/4D42A6ww4XvFxweoxh04Rd/016c2ed9d25bc2267ed3ed31bf8b2bf6/form-fields-variable.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4D42A6ww4XvFxweoxh04Rd/016c2ed9d25bc2267ed3ed31bf8b2bf6/form-fields-variable.png?w=280&fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=4cc24e2b14fccc996200f0e67570bb35 280w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4D42A6ww4XvFxweoxh04Rd/016c2ed9d25bc2267ed3ed31bf8b2bf6/form-fields-variable.png?w=560&fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=dd75b99d6afd4336323974539b6c8695 560w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4D42A6ww4XvFxweoxh04Rd/016c2ed9d25bc2267ed3ed31bf8b2bf6/form-fields-variable.png?w=840&fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=35667a80fa8cdfc3c2e71c90122f090d 840w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4D42A6ww4XvFxweoxh04Rd/016c2ed9d25bc2267ed3ed31bf8b2bf6/form-fields-variable.png?w=1100&fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=23ac2ddff871e0a1074829cb97f0478e 1100w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4D42A6ww4XvFxweoxh04Rd/016c2ed9d25bc2267ed3ed31bf8b2bf6/form-fields-variable.png?w=1650&fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=0b90c4a73f2622e1a9fb124d19800a15 1650w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4D42A6ww4XvFxweoxh04Rd/016c2ed9d25bc2267ed3ed31bf8b2bf6/form-fields-variable.png?w=2500&fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=8c873c801160e14d2694b170dedd3822 2500w" />
</Frame>

### フロー出力アクション変数

フローアクションが実行されると、後続のアクションで参照できる出力オブジェクト応答が生成されます。例：`{{actions.generate_otp.code}}`は、IDが`generate_otp`のアクションの出力コードを参照します。

<Frame>
  <img src="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/bv-cQ5AJj7f50Sl0/docs/images/ja-jp/cdy7uua7fh8z/6jYtEdYqSGXm3DDv0mxQ0o/2d48012629745e07137bf6ba42f4d829/flow-output-variable.png?fit=max&auto=format&n=bv-cQ5AJj7f50Sl0&q=85&s=bcb36567939848c091b1a2e51d4be62c" alt="Dashboard > Actions > Forms > Flows" data-og-width="1404" width="1404" data-og-height="253" height="253" data-path="docs/images/ja-jp/cdy7uua7fh8z/6jYtEdYqSGXm3DDv0mxQ0o/2d48012629745e07137bf6ba42f4d829/flow-output-variable.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/bv-cQ5AJj7f50Sl0/docs/images/ja-jp/cdy7uua7fh8z/6jYtEdYqSGXm3DDv0mxQ0o/2d48012629745e07137bf6ba42f4d829/flow-output-variable.png?w=280&fit=max&auto=format&n=bv-cQ5AJj7f50Sl0&q=85&s=3d8a6fa6dda6ff1d53aecadc3b74de77 280w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/bv-cQ5AJj7f50Sl0/docs/images/ja-jp/cdy7uua7fh8z/6jYtEdYqSGXm3DDv0mxQ0o/2d48012629745e07137bf6ba42f4d829/flow-output-variable.png?w=560&fit=max&auto=format&n=bv-cQ5AJj7f50Sl0&q=85&s=bd73cc0d9b9a4b7ecba9e5e094c96884 560w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/bv-cQ5AJj7f50Sl0/docs/images/ja-jp/cdy7uua7fh8z/6jYtEdYqSGXm3DDv0mxQ0o/2d48012629745e07137bf6ba42f4d829/flow-output-variable.png?w=840&fit=max&auto=format&n=bv-cQ5AJj7f50Sl0&q=85&s=98a768e71565f3d945dc2562d38c65b3 840w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/bv-cQ5AJj7f50Sl0/docs/images/ja-jp/cdy7uua7fh8z/6jYtEdYqSGXm3DDv0mxQ0o/2d48012629745e07137bf6ba42f4d829/flow-output-variable.png?w=1100&fit=max&auto=format&n=bv-cQ5AJj7f50Sl0&q=85&s=31c89a38676cdbf4a9286371b2e8ad7b 1100w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/bv-cQ5AJj7f50Sl0/docs/images/ja-jp/cdy7uua7fh8z/6jYtEdYqSGXm3DDv0mxQ0o/2d48012629745e07137bf6ba42f4d829/flow-output-variable.png?w=1650&fit=max&auto=format&n=bv-cQ5AJj7f50Sl0&q=85&s=60377a446cbe588d98c1dea94fe4ae7b 1650w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/bv-cQ5AJj7f50Sl0/docs/images/ja-jp/cdy7uua7fh8z/6jYtEdYqSGXm3DDv0mxQ0o/2d48012629745e07137bf6ba42f4d829/flow-output-variable.png?w=2500&fit=max&auto=format&n=bv-cQ5AJj7f50Sl0&q=85&s=46ba41977fc2a423381b1d08a9241277 2500w" />
</Frame>

### 共有変数

後続のフローと共有する変数、または同じトランザクション内のフォームコンポーネントと共有する変数を保存できます。共有変数は一時的なものであり、特定のフォームジャーニーに関連付けられています。その値には、そのジャーニーの外部からはアクセスできません。例：`{{vars.external_id}}`は、IDが`external_id`の共有変数の値を参照します。

<Frame>
  <img src="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4571ExRTHL0KZKJKX9pNwj/abb631b8608a6356b0e5b3784cf8b02f/flow-shared-variable.png?fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=b738dac1ff86045b1fe5f83c5eb05110" alt="Dashboard > Actions > Forms > Flows" data-og-width="1215" width="1215" data-og-height="162" height="162" data-path="docs/images/ja-jp/cdy7uua7fh8z/4571ExRTHL0KZKJKX9pNwj/abb631b8608a6356b0e5b3784cf8b02f/flow-shared-variable.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4571ExRTHL0KZKJKX9pNwj/abb631b8608a6356b0e5b3784cf8b02f/flow-shared-variable.png?w=280&fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=dea566a5ea52cc9a1fea1e122ec6aacc 280w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4571ExRTHL0KZKJKX9pNwj/abb631b8608a6356b0e5b3784cf8b02f/flow-shared-variable.png?w=560&fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=04d0e8c5d1e13c4c08720c1f5cb848eb 560w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4571ExRTHL0KZKJKX9pNwj/abb631b8608a6356b0e5b3784cf8b02f/flow-shared-variable.png?w=840&fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=6cfe1c73806aec92804ef6d0dc815400 840w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4571ExRTHL0KZKJKX9pNwj/abb631b8608a6356b0e5b3784cf8b02f/flow-shared-variable.png?w=1100&fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=ffe767a99426754e53e2c7d954738b77 1100w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4571ExRTHL0KZKJKX9pNwj/abb631b8608a6356b0e5b3784cf8b02f/flow-shared-variable.png?w=1650&fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=5a83c3f8efeb01929ca3b002a852ce7d 1650w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/gaAFJyQnll7qN4Y6/docs/images/ja-jp/cdy7uua7fh8z/4571ExRTHL0KZKJKX9pNwj/abb631b8608a6356b0e5b3784cf8b02f/flow-shared-variable.png?w=2500&fit=max&auto=format&n=gaAFJyQnll7qN4Y6&q=85&s=c6b2943895b95f6c2a1c12f0c13dd878 2500w" />
</Frame>

<Warning>
  共有変数は：

  * 内部（サーバー側）であり、ブラウザー（クライアント側）には公開されません。
  * フォームコンポーネントで共有変数を参照した場合、解決してブラウザーに公開できます。
</Warning>

### ヘルパー関数

ヘルパー関数を使用すると、データを変換して簡単な操作を実行できます。例：`{{functions.toString(fields.privacy_policies)}}`は、`toString()`関数を使用して、ID`privacy_policies`のフィールドの値を変換します。

<Frame>
  <img src="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/N20ajriyStIVKiUa/docs/images/ja-jp/cdy7uua7fh8z/1gyox33XJEtdkT43NppblT/0e878cc5ae2bde11b4207e105bbac6c5/flow-helper-functions.png?fit=max&auto=format&n=N20ajriyStIVKiUa&q=85&s=152b22c0ca05bfab5f805252db6fc1cb" alt="Dashboard > Actions > Forms > Flows" data-og-width="1404" width="1404" data-og-height="290" height="290" data-path="docs/images/ja-jp/cdy7uua7fh8z/1gyox33XJEtdkT43NppblT/0e878cc5ae2bde11b4207e105bbac6c5/flow-helper-functions.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/N20ajriyStIVKiUa/docs/images/ja-jp/cdy7uua7fh8z/1gyox33XJEtdkT43NppblT/0e878cc5ae2bde11b4207e105bbac6c5/flow-helper-functions.png?w=280&fit=max&auto=format&n=N20ajriyStIVKiUa&q=85&s=535349461ef132fe53884dc96898dbf4 280w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/N20ajriyStIVKiUa/docs/images/ja-jp/cdy7uua7fh8z/1gyox33XJEtdkT43NppblT/0e878cc5ae2bde11b4207e105bbac6c5/flow-helper-functions.png?w=560&fit=max&auto=format&n=N20ajriyStIVKiUa&q=85&s=63d600c0270559d008e7dbceb51906dd 560w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/N20ajriyStIVKiUa/docs/images/ja-jp/cdy7uua7fh8z/1gyox33XJEtdkT43NppblT/0e878cc5ae2bde11b4207e105bbac6c5/flow-helper-functions.png?w=840&fit=max&auto=format&n=N20ajriyStIVKiUa&q=85&s=7a48e71551e21b7d2cd6bab963d5246d 840w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/N20ajriyStIVKiUa/docs/images/ja-jp/cdy7uua7fh8z/1gyox33XJEtdkT43NppblT/0e878cc5ae2bde11b4207e105bbac6c5/flow-helper-functions.png?w=1100&fit=max&auto=format&n=N20ajriyStIVKiUa&q=85&s=8f5ce151d3b93df7c456ab944b64080a 1100w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/N20ajriyStIVKiUa/docs/images/ja-jp/cdy7uua7fh8z/1gyox33XJEtdkT43NppblT/0e878cc5ae2bde11b4207e105bbac6c5/flow-helper-functions.png?w=1650&fit=max&auto=format&n=N20ajriyStIVKiUa&q=85&s=ccb2d5384f95f98a8bf32f4d710d947b 1650w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/N20ajriyStIVKiUa/docs/images/ja-jp/cdy7uua7fh8z/1gyox33XJEtdkT43NppblT/0e878cc5ae2bde11b4207e105bbac6c5/flow-helper-functions.png?w=2500&fit=max&auto=format&n=N20ajriyStIVKiUa&q=85&s=20ba0db64ea84a13068e59ceb9a5ad93 2500w" />
</Frame>

使用可能なヘルパー関数は次のとおりです。

| 関数                                     | 説明                                                                                                                                                                                                            | 例                                                                                                             |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| toArray(value)                         | 値を配列に変換します                                                                                                                                                                                                    | `{{ functions.toArray('abc') }} // ['abc']`                                                                   |
| toBoolean(value)                       | 値をブール値に変換します                                                                                                                                                                                                  | `{{ functions.toBoolean(1) }} // true `<br /><br />`{{ functions.toBoolean(0) }} // false`                    |
| length(value)                          | パラメーター値の長さを返します                                                                                                                                                                                               | `{{ functions.length('auth0') }} // 5`                                                                        |
| mask(value)                            | 実行時に公開されないように値をマスクします                                                                                                                                                                                         | `{{ functions.mask('my_awesome_secret') }} // ███`                                                            |
| toNumber(value)                        | 値を数値に変換します                                                                                                                                                                                                    | `{{ functions.toNumber('123') }} // 123`                                                                      |
| random(min, max, \[boolean])           | 最小値と最大値の間の乱数を返します                                                                                                                                                                                             | `{{ functions.random(0, 6) }} // 4 `<br /><br />`{{ functions.random(0, 6, true) }} // 3.8523497...`          |
| slice(value, start, end)               | 開始インデックスと終了インデックスの間の値配列または文字列のセクションを返します                                                                                                                                                                      | `{{ functions.slice( 'example', 3, 5) }} // 'mp'`                                                             |
| toString(value)                        | 値を文字列に変換します                                                                                                                                                                                                   | `{{ functions.toString(123) }} // '123'`                                                                      |
| substring(value, start, end)           | 開始インデックスと終了インデックスの間の値のセクションを返します。[sliceとsubstring関数の違い](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring#differences_between_substring_and_slice)についてお読みください | `{{ functions.substring( 'example’', 3, 5) }} // 'mp'`                                                        |
| toTimestamp()                          | 現在のUNIXタイムスタンプを返します                                                                                                                                                                                           | `{{ functions.toTimestamp() }} // 1628761483`                                                                 |
| toTimestamp(date)                      | 指定された日付をUNIX時間で返します                                                                                                                                                                                           | `{{ functions.toTimestamp('2021-04-30T10:02:50.876Z') }} // 1619776970`                                       |
| toTimestamp(date)                      | 指定された日付をUNIX時間で返します                                                                                                                                                                                           | `{{ functions.toTimestamp('2021-04-30T10:02:50.876Z') }} // 1619776970`                                       |
| replaceAll(value, string, replacement) | パターンに一致するすべての部分を置換文字列に置き換えた新しい文字列を返します。                                                                                                                                                                       | `{{ functions.replaceall('2021-04-30', '-', '/') }} // 2021/04/30`                                            |
| replace(value, string, replacement)    | パターンに一致するすべての部分を置換文字列に置き換えた新しい文字列を返します。パターンが文字列の場合、最初の出現のみが置換されます。                                                                                                                                            | `{{ functions.replace('2021-04-30', '-', '/') }} // 2021/04-30`                                               |
| split(value, Separator, limit?)        | セパレーターで区切られた部分文字列の順序付きリストを返します。                                                                                                                                                                               | `{{ functions.split('2021-04-30', '-') }} // ['2021', '04', '30']`                                            |
| now()                                  | 現在の日付をISO8601形式で返します。                                                                                                                                                                                         | `{{ functions.now() }} // 2021-04-30T10:31:28.576Z`                                                           |
| includes(collection, item, fromIndex?) | 配列のエントリに特定の値が含まれているかどうかを返します。                                                                                                                                                                                 | `{{ functions.includes(['auth0', 'identity', 'authentication'], 'identity') }} // true`                       |
| indexOf(collection, item, fromIndex?)  | 配列内で特定の要素が見つかる最初のインデックスを返します。存在しない場合は-1を返します。                                                                                                                                                                 | `{{ functions.indexOf(['auth0', 'identity', 'authentication'], 'identity') }} // 1`                           |
| merge(base, value)                     | 基本データ型に応じて、結合された配列、オブジェクト、または連結された文字列を返します。                                                                                                                                                                   | `{{ functions.merge(['auth0', 'identity'], ['authentication']) }} // ['auth0', 'identity', 'authentication']` |
| md5(value)                             | MD5 ハッシュ値を返します。                                                                                                                                                                                               | `{{ functions.md5('auth0') }} // 7bbb597...`                                                                  |
| sha1(value)                            | SHA1 ハッシュ値を返します。                                                                                                                                                                                              | `{{ functions.sha1('auth0') }} // b4ec5339...`                                                                |
| sha256(value)                          | SHA256ハッシュ値を返します。                                                                                                                                                                                             | `{{ functions.sha256('auth0') }} // d9082bdc...`                                                              |
| sha512(value)                          | SHA512ハッシュ値を返します。                                                                                                                                                                                             | `{{ functions.sha512('auth0') }} // c0d588069d...`                                                            |
| uuid()                                 | ランダムなv4 UUIDを返します                                                                                                                                                                                             | `{{ functions.uuid() }} // 36b8f84d-df4e-4d49-b662-bcde71a8764`                                               |

## 変数のベストプラクティス

### 意味のあるIDを使用する

フォームフィールドまたはフローアクションを追加すると、IDが自動的に生成されます。

IDをよりわかりやすい値に更新して、含まれる情報を識別できるようにします。たとえば、ユーザーの名を保存するフォームフィールドを作成する場合は、IDを`first_name`に更新します。

### 既存のIDを更新するときは注意してください

変数がすでに使用されており、IDを変更する必要がある場合は、参照した場所を特定し、それに応じてIDを更新して、未定義または空の値にならないようにします。

### フロー実行を確認する

予期しない変数値が表示された場合は、[**実行** ](/docs/ja-jp/customize/forms/flows/flow-execution-and-debugger)ビューを使用して変数のトラブルシューティングを行います。

### オートコンプリートメニューを使用する

オートコンプリートメニューを使用すると、既存の変数を見つけて適切に参照できます。

<Frame>
  <img src="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3SKnDuaMzSImxZtDDAoZaz/9ea800fad29ef71d1ded3c72b87660a4/Autocomplete-flows.png?fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=c922477a89189320305664be75448445" alt="Dashboard > Actions > Forms > Flows" data-og-width="1361" width="1361" data-og-height="502" height="502" data-path="docs/images/ja-jp/cdy7uua7fh8z/3SKnDuaMzSImxZtDDAoZaz/9ea800fad29ef71d1ded3c72b87660a4/Autocomplete-flows.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3SKnDuaMzSImxZtDDAoZaz/9ea800fad29ef71d1ded3c72b87660a4/Autocomplete-flows.png?w=280&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=4b1b1d0faa2dd57bb6194efb58126844 280w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3SKnDuaMzSImxZtDDAoZaz/9ea800fad29ef71d1ded3c72b87660a4/Autocomplete-flows.png?w=560&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=a142c05adb303d6f8e01b798ae04a0fe 560w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3SKnDuaMzSImxZtDDAoZaz/9ea800fad29ef71d1ded3c72b87660a4/Autocomplete-flows.png?w=840&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=22f2f17e10f6a7ac1fa9481e696a7ca7 840w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3SKnDuaMzSImxZtDDAoZaz/9ea800fad29ef71d1ded3c72b87660a4/Autocomplete-flows.png?w=1100&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=d319727684f05f6853906826d67fb3dd 1100w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3SKnDuaMzSImxZtDDAoZaz/9ea800fad29ef71d1ded3c72b87660a4/Autocomplete-flows.png?w=1650&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=769271f3212dda11a4214708e0588ff8 1650w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/3SKnDuaMzSImxZtDDAoZaz/9ea800fad29ef71d1ded3c72b87660a4/Autocomplete-flows.png?w=2500&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=9a9571e0c8d2ff205d358806862f8941 2500w" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/2kjRKozVgrd2a7UJXOANaN/ee5452d7210cd2f13b0e97763f11c82a/Autocomplete-forms.png?fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=bb6a6fee36d305e78769d5c04074d1b9" alt="Dashboard > Actions > Forms > Form" data-og-width="1394" width="1394" data-og-height="630" height="630" data-path="docs/images/ja-jp/cdy7uua7fh8z/2kjRKozVgrd2a7UJXOANaN/ee5452d7210cd2f13b0e97763f11c82a/Autocomplete-forms.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/2kjRKozVgrd2a7UJXOANaN/ee5452d7210cd2f13b0e97763f11c82a/Autocomplete-forms.png?w=280&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=9c666a106c5ea543a426292e0337095c 280w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/2kjRKozVgrd2a7UJXOANaN/ee5452d7210cd2f13b0e97763f11c82a/Autocomplete-forms.png?w=560&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=069fd06f186653981606d462901c1a67 560w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/2kjRKozVgrd2a7UJXOANaN/ee5452d7210cd2f13b0e97763f11c82a/Autocomplete-forms.png?w=840&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=9d4127b08cacff4e74102a2b745a2375 840w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/2kjRKozVgrd2a7UJXOANaN/ee5452d7210cd2f13b0e97763f11c82a/Autocomplete-forms.png?w=1100&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=be571ae6e94715478bf1c4bd3c6002c2 1100w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/2kjRKozVgrd2a7UJXOANaN/ee5452d7210cd2f13b0e97763f11c82a/Autocomplete-forms.png?w=1650&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=d9ef403d118160bf1d5d9c79118667d2 1650w, https://mintcdn.com/docs-dev-fix-ss-log-app-metadata-user-metadata-clarification/WG3S36gMqei1vWEV/docs/images/ja-jp/cdy7uua7fh8z/2kjRKozVgrd2a7UJXOANaN/ee5452d7210cd2f13b0e97763f11c82a/Autocomplete-forms.png?w=2500&fit=max&auto=format&n=WG3S36gMqei1vWEV&q=85&s=22420a62afde6a9ced0f0bc123e65e29 2500w" />
</Frame>
