Studio

Incoming reference decoration

Display incoming references directly in a document's form, without storing the data as part of the document.

Studio's inline incoming references feature allows you to define a component that will display any incoming references to the current document.

Unlike a field containing an array of references, these incoming references are not part of the document and will display automatically when new references are made.

Prerequisites:

  • Studio v5.8.0 or later is required to use incoming reference fields.

Add an inline incoming reference decoration

To add incoming references to a field in your schema, import and use the defineIncomingReferenceDecoration helper.

This adds a component into the document that looks like the following:

Loading...

Create and reference new documents

You can allow the "Create" button to pre-populate a new document with a reference to the source document.

This feature can leverage the initialValue of a new document to set the reference. On the schema for the referencing document type, use the isIncomingReferenceCreation helper to check if an incoming reference field is creating the new document. Then pass in the reference to the appropriate field. In this example, the book document type references the author type.

Add reference to existing documents

If you have existing documents that you want to search/assign to the current document, use the onLinkDocument option.

Create custom actions

You can also pass custom actions to the incoming reference field. This format is similar to document actions, but occurs in the defineIncomingReferenceDecoration helper. This example creates an action in ReferenceActions.tsx and applies it in the actions array.

Support cross-dataset references

Cross-dataset references are also supported. You'll need to supply additional details as shown below.

Was this page helpful?