- CMS
- How-to guides
- Connect models with a reference field
Connect models with a reference field
Last updated
A reference field lets an item in one model specify an item in the model it references. You add a reference field on the Schema screen.
Owner, Maintainer, and Writer can add, edit, and delete a reference field. Reader can view the schema.
Clicking Reference opens the Create Reference Field screen. This screen is divided into stages.
- Reference setting: choose the model to reference and the reference direction.
- Field: set the field to add to this model.
- Corresponding field: set the field to add to the other model. This stage is added only when you choose a two-way reference.
Support multiple values cannot be set on a reference field in either reference direction.
Add a one-way reference
Section titled “Add a one-way reference”Lets an item in this model specify an item in the other model. Nothing is added to the other model.
-
Under Models on Schema, choose the model you are adding a field to.
-
Under Add Field, click Reference. The Create Reference Field screen opens.
-
In Select the model to reference, choose the model you are referencing.
-
Under Reference direction, choose One-way reference.
-
Click Next.
-
On the Settings tab, enter the Display name. When you enter it with alphanumeric characters, a string based on the Display name is filled into Field Key automatically. In the string filled into Field Key, spaces become hyphens and uppercase letters become lowercase.
-
Check the Field Key. When the field has no value, or when an error is shown, enter the key yourself.
-
In Description, enter what goes into this field. This is optional.
-
On the Validation tab, set the conditions for the value.
- Turn on Make field required if a value must always be entered, and Set field as unique if the same item in the other model must not be specified from two or more items in this model.
-
Click Confirm.
Add a two-way reference
Section titled “Add a two-way reference”Adds a field to both this model and the other model, so that items on each side can specify the other.
-
Under Models on Schema, choose the model you are adding a field to.
-
Under Add Field, click Reference. The Create Reference Field screen opens.
-
In Select the model to reference, choose the model you are referencing.
-
Under Reference direction, choose Two-way reference.
-
Click Next.
-
On the Settings tab, enter the Display name of the field to add to this model.
-
Check the Field Key. When the field has no value, or when an error is shown, enter the key yourself.
-
In Description, enter what goes into this field. This is optional.
-
On the Validation tab, set the conditions for the value.
- Turn on Make field required if a value must always be entered. Set field as unique cannot be set on a two-way reference.
-
Click Next.
-
In Corresponding field, enter the Display name, Field Key, and Description of the field to add to the other model.
-
On the Validation tab, set the conditions for the value of the field to add to the other model.
- Turn on Make field required if a value must always be entered.
-
Click Confirm.
At the Corresponding field stage, clicking Back returns you to the Field stage. There is no way to go back from Field to Reference setting.
Change a reference field’s settings
Section titled “Change a reference field’s settings”After adding it, you can change the Display name, Field Key, and Description along with the validation settings. The model being referenced and the reference direction cannot be changed. To change them, delete the field and create it again.
- In the list on the Fields tab, click the edit icon (…) of the reference field you are changing. The Update Reference Field screen opens.
- Check the contents of Reference setting and click Next. Select the model to reference and Reference direction cannot be operated.
- Change the settings on the Settings and Validation tabs.
- For a two-way reference, click Next and check the Corresponding field settings as well.
- Click Confirm.
Delete a reference field
Section titled “Delete a reference field”Deletes a reference field you no longer need.
- In the list on the Fields tab, click the delete icon of the reference field you are deleting.
- Check that the display name shown on the confirmation screen belongs to the reference field you are deleting.
- Click Delete field.