Skip to main content

Foreign Key

Foreign key fields store one related record key from another form. They are used when the current record should keep a direct relationship to a target form record.

Use a foreign key field when the relationship needs a source form and a deletion rule, such as an invoice linked to a contract, a shipment linked to an order, or a service ticket linked to an asset.

Basic Settings​

SettingDescription
NameThe field label shown to users. It is required and should describe the relationship clearly
API NameThe stable technical name used by data APIs, scripts, formulas, imports, and integrations. It is required
RequiredRequires users to select a related record before the record can be saved
ReadonlyShows the selected related record but prevents users from changing it
DisabledMakes the field unavailable for normal use
HiddenStores the selected value while hiding it from normal form pages

Foreign Key Field Config​

SettingDescription
Source FormThe target form that provides selectable records. It is required
Delete RuleControls what happens to this field when the related target record is deleted
Relation Data ScopeOptional Studio script that filters which target records users can select
Validate TriggerControls when selection validation runs: when the value changes, when the field loses focus, or when the record is submitted
PlaceholderPrompt text shown before users select a related record
Modal TitleTitle shown in the record selection dialog
Search PlaceholderPrompt text shown in the search box inside the selection dialog
Input StatusAdds a visual status to the field, such as warning or error
Invalid Selection MessageCustom message shown when the selected record is invalid or unavailable
Field ColorSets the display color used for the field
Help TextHelper copy shown near the field. Use it to explain which related record users should choose

Delete Rules​

RuleMeaning
Restrict DeleteThe target record cannot be deleted while it is still referenced
Set NullThe field is cleared when the target record is deleted
Cascade DeleteThe current record is deleted together with the target record

Relation Data Scope​

Use Relation Data Scope when this field should only allow a scoped set of records from the source form.

Examples:

  • Only active master records
  • Only contracts in the current customer account
  • Only assets that are available for assignment

The script is bound to this source field and runs before the selection dialog loads target records. It returns a relationDataFilter condition that uses target-form field API names.

Do not configure this filtering rule on the target form's page events. See Relation Data Scope for the payload and response contract.

Common Examples​

ScenarioSource FormSuggested Rule
Invoice links to contractContractRestrict Delete
Shipment links to orderOrderRestrict Delete
Ticket links to assetAssetSet Null
Detail record belongs to master recordMaster FormCascade Delete

Configuration Tips​

TipDescription
Choose the delete rule carefullyUse cascade only when the current record should not exist without the target record
Keep the source form stableChanging the source form changes the meaning of stored relation keys
Write a specific placeholderA placeholder such as "Select a contract" makes the relationship clear
Add an invalid selection messageUse it to explain why a previously selected target record can no longer be used