Some checks failed
App Prod-Parity E2E Dispatch / dispatch (push) Failing after 10s
CD Storybook UI / build (push) Failing after 3m25s
CD Storybook UI / dispatch (push) Has been skipped
CD deploy main / website-changed-files (push) Successful in 18m8s
CI Agent Skills / changed-files-check (push) Successful in 18m9s
CI Create App E2E minimal / changed-files-check (push) Successful in 24s
CI Create App / changed-files-check (push) Successful in 26s
CI Docs / changed-files-check (push) Successful in 26s
CI Emails / changed-files-check (push) Successful in 28s
CI Example App Hello World / changed-files-check (push) Successful in 23s
CI Front / changed-files-check (push) Has been skipped
CI Example App Postcard / changed-files-check (push) Successful in 27s
CI UI / changed-files-check (push) Has been skipped
CI Utils Test / changed-files-check (push) Successful in 45s
CI Twenty Apps / discover (push) Successful in 1m3s
CD deploy main / deploy-main (push) Failing after 3s
CI Agent Skills / agent-skills-validate (push) Has been skipped
CI Create App / create-app-test (lint) (push) Has been skipped
CI Emails / emails-test (push) Has been skipped
CI Front / front-task (lingui:compile) (push) Has been skipped
CI Front / front-task (lint) (push) Has been skipped
CI Example App Postcard / example-app-postcard (push) Has been skipped
CI UI / ui-task (lint) (push) Has been skipped
CI UI / ui-task (pack-size) (push) Has been skipped
CI UI / ui-task (size) (push) Has been skipped
CI UI / ui-task (test) (push) Has been skipped
CI UI / ui-task (typecheck) (push) Has been skipped
CI Utils Test / utils-test (push) Has been skipped
CI Twenty Apps / ${{ matrix.app.name }} (push) Has been skipped
CI Emails / ci-emails-status-check (push) Successful in 2s
CI Example App Hello World / ci-example-app-hello-world-status-check (push) Successful in 2s
CI Example App Postcard / ci-example-app-postcard-status-check (push) Successful in 3s
CI UI / ui-sb-test (push) Has been skipped
CI Utils Test / ci-utils-test-status-check (push) Successful in 2s
CI Twenty Apps / ci-twenty-apps-status-check (push) Successful in 2s
CI UI / ci-ui-status-check (push) Successful in 2s
CI Desktop / desktop (push) Failing after 1m8s
Push docs to Crowdin / Push documentation to Crowdin (push) Failing after 55s
Push translations to Crowdin / Extract and upload translations (push) Failing after 5s
Push website translations to Crowdin / Extract and upload website translations (push) Failing after 5s
CI Create App / create-app-test (test) (push) Has been skipped
CI Create App / create-app-test (typecheck) (push) Has been skipped
CI Docs / docs-lint (push) Has been skipped
CI Example App Hello World / example-app-hello-world (push) Has been skipped
CI Front / front-task (lingui:extract) (push) Has been skipped
CI Front / front-task (test) (push) Has been skipped
CI Front / front-task (typecheck) (push) Has been skipped
CI UI / ui-sb-build (push) Failing after 1m32s
CI Twenty Apps / ${{ matrix.app.name }} (${{ matrix.server-source }}) (push) Has been skipped
CI Agent Skills / agent-skills-publish (push) Has been skipped
CI Create App / ci-create-app-status-check (push) Successful in 2s
CI Agent Skills / agent-skills-remote-source (push) Has been skipped
CI Create App E2E minimal / create-app-e2e-minimal (push) Has been cancelled
CI E2E Main / e2e-test (push) Has been cancelled
CI Front / front-sb-build (push) Has been cancelled
CI Front / front-build (push) Has been cancelled
CI Create App E2E minimal / ci-create-app-e2e-minimal-status-check (push) Has been cancelled
CI E2E Main / ci-e2e-main-status-check (push) Has been cancelled
CI E2E Main / notify-main-ci-failure (push) Has been cancelled
CI E2E Main / qa-scout-comment (push) Has been cancelled
CI Front / front-sb-test (push) Has been cancelled
CI Front / front-sb-screenshots (push) Has been cancelled
CI Front / ci-front-status-check (push) Has been cancelled
DPA Sub-Processor Sync / sync-subprocessors (push) Failing after 3s
AI Catalog Sync / sync-catalog (push) Failing after 2s
95 lines
4.7 KiB
Plaintext
95 lines
4.7 KiB
Plaintext
---
|
||
title: リレーションフィールド
|
||
description: リレーションフィールドを使用して、異なるオブジェクト間でレコードをリンクします。
|
||
---
|
||
|
||
## リレーションの種類
|
||
|
||
### 1対多
|
||
|
||
オブジェクトAの1件のレコードは、オブジェクトBの複数のレコードにリンクできます。
|
||
|
||
**例:** 1つの会社には多数の連絡先(従業員)がいます。
|
||
|
||
### 多対1
|
||
|
||
オブジェクトAの複数のレコードは、オブジェクトBの1件のレコードにリンクできます。
|
||
|
||
**例:** 多数の連絡先は1社に所属できます。
|
||
|
||
### 複数のオブジェクトタイプへのリレーション
|
||
|
||
一部のオブジェクトは、リレーションの片側で複数のオブジェクトタイプにリンクできます。
|
||
|
||
**例:** メモは、連絡先1件、会社1社、商談1件に同時にリンクできます。 メモは"多"の側にあり、複数の"1"の側にリンクしています。
|
||
|
||
<img src="/images/user-guide/fields/many-to-one-morph.png" style={{width:'100%'}} />
|
||
|
||
同様に、プロジェクト("1"の側)は、複数の連絡先、複数の会社、複数のメモからリンクを受け取ることができます。
|
||
|
||
<img src="/images/user-guide/fields/one-to-many-morph.png" style={{width:'100%'}} />
|
||
|
||
<Warning>
|
||
**インポート/エクスポートの制限**: 複数のオブジェクトタイプを指すリレーションは、CSV のインポート/エクスポートにはまだ対応していません。 これはロードマップに含まれています。
|
||
</Warning>
|
||
|
||
### 多対多
|
||
|
||
オブジェクトAの複数のレコードは、オブジェクトBの複数のレコードにリンクできます。
|
||
|
||
**例:** 多数の連絡先は多数のプロジェクトにリンクでき、その逆も可能です。
|
||
|
||
多対多のリレーションでは、両側を接続する中間オブジェクトを用いる**ジャンクションオブジェクト**パターンを使用します。 ジャンクションリレーション機能により、Twenty は最終的にリンクされたレコードを直接表示し、中間オブジェクトを UI から隠します。
|
||
|
||
<Warning>
|
||
**ベータ機能**: 使用前に **Settings → Community → Features** でジャンクションリレーションを有効化する必要があります。
|
||
</Warning>
|
||
|
||
完全なステップバイステップのガイドについては、[多対多リレーションの作成方法](/l/ja/user-guide/data-model/how-tos/create-many-to-many-relations) を参照してください。
|
||
|
||
## リレーションフィールドの作成
|
||
|
||
1. **設定 → データモデル** に移動
|
||
2. リレーションを追加したいオブジェクトを選択します
|
||
3. **+ 新規フィールド** をクリックしてください
|
||
4. フィールドタイプとして **Relation** を選択
|
||
5. 関連付け先のオブジェクトを選択します
|
||
6. リレーションの設定を行います:
|
||
* **ソースオブジェクト上のフィールド名**: 編集しているオブジェクト上のリレーションフィールドの名前
|
||
* **対象オブジェクト上のフィールド名**: 対象オブジェクトに表示されるリレーションフィールドの名前
|
||
* リレーションタイプ(1対多、多対1)
|
||
7. **保存**をクリック
|
||
|
||
## 標準リレーション
|
||
|
||
Twenty には標準オブジェクト間のあらかじめ用意されたリレーションがあります:
|
||
|
||
| 元オブジェクト | 宛先オブジェクト | リレーションタイプ |
|
||
| ------- | -------- | --------- |
|
||
| 人物 | 会社 | 多対1 |
|
||
| 商談 | 会社 | 多対1 |
|
||
| 商談 | 人物 | 多対1 |
|
||
|
||
## ベストプラクティス
|
||
|
||
### リレーションの計画
|
||
|
||
* **データモデルをマッピング**: 作成前にリレーションを計画する
|
||
* **方向性を検討**: どのオブジェクトがそのリレーションを"所有"するかを考える
|
||
* **循環依存を避ける**: データモデルをクリーンに保つ
|
||
|
||
### リレーションの命名
|
||
|
||
* **明確な名前を使う**: リレーションが何を表すかが一目でわかるようにする
|
||
* **一貫性を保つ**: リレーション全体で似た命名パターンを使用する
|
||
* **両側を考慮する**: リレーションの両側に適切な名前を付ける
|
||
|
||
### パフォーマンス
|
||
|
||
* **リレーションの作りすぎに注意**: リレーションが多すぎるとワークスペースが遅くなる可能性があります
|
||
|
||
## 制限事項
|
||
|
||
* **リレーションを削除**するとリンクは削除されますが、関連レコード自体は削除されません。
|
||
* **循環リレーション**はデータの整合性のため避けるべきです
|