Skip to main content

CnRelationLinkModal

Link an existing related object to the current object.

Async-searches a target register + schema (via CnResourceSelect in link-mode — allowCreate defaults to false, so it behaves as a plain existing-object picker) and, on confirm, PATCHes a foreign-key field on the current object with the chosen object's id, saving through useObjectStore. Used by CnDetailPage's declarative relation-link action (config.relationLinks).

Props

PropTypeDefaultDescription
titleString'Link related object'Modal heading.
selectLabelString'Search…'Accessible label for the picker.
registerString— (required)Target register slug to search.
schemaString— (required)Target schema slug to search.
labelFieldString'name'Field used as the option label.
allowCreateBooleanfalseWhether the picker offers inline create-from-search.
currentTypeString— (required)Object-type slug (${register}-${schema}) of the CURRENT object being patched.
currentObjectObject— (required)The current object (must carry an id).
fkFieldString— (required)The foreign-key field on the current object to write the chosen id into.

Events

EventPayloadDescription
linkedobjectThe FK was patched and saved; payload is the updated object.
closeThe modal was dismissed (Cancel or after a successful link).