> For the complete documentation index, see [llms.txt](https://docs.labii.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.labii.com/widgets/section-widgets/data-display/sections/section-display-by-foreignkey.md).

# Section Display By ForeignKey

## Specs

| Label                     | Value                                  |
| ------------------------- | -------------------------------------- |
| **Version**               | Not documented (updated on 2026-06-14) |
| **Developer**             | Labii Inc.                             |
| **Type**                  | Section                                |
| **Support Configuration** | Yes                                    |

## Overview

The Section Display By ForeignKey widget displays sections from a related record inside the current Labii record without requiring users to manually choose the source record each time. Instead of selecting a target record directly, the widget reads a relationship from a [ForeignKey](/widgets/column-widgets/form/dropdown/foreignkey.md) or [ForeignKeys](/widgets/column-widgets/form/dropdown/foreignkeys.md) column and uses that linked record as the content source. This makes the widget useful for reusing SOP content, shared project files, template sections, and other controlled reference material across multiple records while reducing duplication and keeping updates connected to the original source.

## Use Cases

* **SOP Reuse**: Display controlled procedure sections from an SOP record inside experiment records.
* **Project Reference Content**: Show common files, instructions, or notes from a linked project or account record.
* **Template-Based Documentation**: Pull standard record sections into downstream work records through a relationship field.
* **Cross-Record Context**: Keep reference content visible without copying and pasting the same section into multiple records.
* **Compliance Workflows**: Freeze displayed content to a selected version when records need traceable, version-specific references.

## Interface

### Read-only View

In read-only mode, the widget renders the sections from the related source record directly inside the current record. This mode is used when **Is Readonly** is enabled or when a specific **Version** is selected, ensuring the referenced content is displayed without in-place editing.

* **Data Display**: Shows the source sections from the related record inside the current record layout.
* **Linked Resolution**: Automatically resolves the source record from the configured ForeignKey or ForeignKeys field.
* **Version Awareness**: Can display the latest source content or a frozen version, depending on configuration.
* **Review Use**: Useful for SOP review, controlled reference content, and signed-record workflows.

<figure><img src="/files/vIYWF3qL0mc6o86fHjVN" alt="Read-only view of the Section Display By ForeignKey widget"><figcaption><p>The read-only view displays sections from the linked source record inside the current record.</p></figcaption></figure>

### Edit View

In edit mode, the widget configuration controls which relationship field is used and whether the displayed source sections remain editable. If **Is Readonly** is cleared and no fixed version is selected, the displayed content follows the same editable pattern as Section Display By Record.

* **Input Methods**: Select the relationship column that points to the source record.
* **Formatting Options**: Choose whether to use the latest content or pin the display to a specific version.
* **Validation**: The selected field must be a ForeignKey or ForeignKeys column that resolves to at least one related record.
* **Collaboration**: Lets teams expose shared content across records while controlling whether edits are allowed.

{% hint style="info" %}
When the source field is a ForeignKeys column, the widget uses the first related record returned by that field.
{% endhint %}

## Configuration

### Initial Setup

{% stepper %}
{% step %}
Open the record and add the **Section Display By ForeignKey** widget to a section.
{% endstep %}

{% step %}
Switch the section to **Edit** mode or open the widget settings.
{% endstep %}

{% step %}
Select the relationship column that contains the source record reference.
{% endstep %}

{% step %}
Optionally choose a specific source version or enable **Is Readonly**, then save the record.
{% endstep %}
{% endstepper %}

### Required Settings

* **Column**: Select the ForeignKey or ForeignKeys column that points to the source record whose sections should be displayed.

### Optional Settings

* **Version**: Select a specific version of the source record when you need the displayed content to stay fixed instead of following the newest version.
* **Is Readonly**: Display the linked sections in read-only mode when you want users to review rather than edit the referenced content.

{% hint style="info" %}
If no version is selected, the widget uses the newest available version of the linked source record. When the current record is signed, a latest version is assigned automatically.
{% endhint %}

### Advanced Configuration

For more predictable reuse across many records, standardize the relationship field that stores your source record reference.

{% stepper %}
{% step %}
Create a consistent ForeignKey or ForeignKeys field in the relevant table design for referencing SOPs, templates, or shared source records.
{% endstep %}

{% step %}
Use version pinning for workflows that require stable referenced content during approvals, signatures, or audits.
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
If the selected relationship field is empty or points to the wrong record, the widget will not display the expected sections. Review the source field before troubleshooting the section display itself.
{% endhint %}

## Additional Functions

### Automatic Source Resolution

The widget removes the need to manually pick a source record in every destination record.

* **Relationship-Driven Display**: Reads the source record automatically from the configured field.
* **Reduced Duplication**: Reuses live content instead of copying the same section into multiple records.
* **Faster Setup**: Supports scalable record templates when the source relationship is already part of the table structure.

### Version Pinning

Use version selection when the displayed content must remain stable for review or compliance purposes.

{% stepper %}
{% step %}
Open the widget configuration.
{% endstep %}

{% step %}
Select the desired source **Version** if you want to freeze the displayed content.
{% endstep %}

{% step %}
Save the record and confirm that the expected source version is shown.
{% endstep %}
{% endstepper %}

### Integration Features

* **Relationship Widget Integration**: Works with ForeignKey and ForeignKeys columns to identify the source record.
* **Record Reuse Integration**: Pairs well with table designs that centralize SOPs, account resources, templates, or shared project content.
* **Documentation Integration**: Keeps referenced sections visible alongside the current record's own notes and data.

### Version Control and Audit Trail

* **Version Traceability**: Supports frozen source versions for controlled documentation workflows.
* **Configuration Traceability**: The chosen source column remains part of the widget setup for repeatable record behavior.
* **Record Integrity**: Helps preserve a single authoritative source for shared sections while still surfacing the content where it is needed.

## Best Practices

### Data Organization

* Store reference relationships in dedicated ForeignKey or ForeignKeys fields instead of relying on manual section duplication.
* Use clear naming conventions for source records so the linked content is easy to verify.
* Separate reusable controlled content, such as SOPs or common attachments, into source records designed for reuse.

### Workflow Design

* Use **Version** pinning for regulated or approval-based workflows where the displayed content must not drift.
* Leave the widget unpinned only when users should always see the latest version of the referenced sections.
* Pair this widget with record templates so linked reference content appears automatically in downstream records.

### Review and Compliance

* Verify the linked source record before signing destination records that depend on referenced sections.
* Prefer read-only mode when the displayed content is intended as a controlled reference.
* Document the purpose of the source relationship field so collaborators understand why the section appears automatically.

{% hint style="success" %}
This widget is most effective when a single source record acts as the controlled reference and all destination records point to it through a consistent relationship field.
{% endhint %}

### Common Pitfalls to Avoid

* **Avoid using a free-text field instead of a ForeignKey field**, because the widget expects a structured relationship to resolve the source record.
* **Avoid leaving version behavior implicit in regulated workflows**, because users may assume the content is frozen when it is still following the newest version.
* **Avoid using a ForeignKeys field without understanding record order**, because the widget uses the first related record from that field.

## Related Widgets

* [Section Display by Record](/widgets/section-widgets/data-display/sections/section-display-by-record.md): Use this widget when users should manually choose the source record instead of deriving it from a relationship field.
* [ForeignKey](/widgets/column-widgets/form/dropdown/foreignkey.md): Use this column widget to store the single related record that this section widget can display.
* [ForeignKeys](/widgets/column-widgets/form/dropdown/foreignkeys.md): Use this column widget when multiple related records are stored, noting that this section widget uses the first related record.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.labii.com/widgets/section-widgets/data-display/sections/section-display-by-foreignkey.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
