Display the Most Recent Child Record in a Filtered Modal
Learn how to display the most recent child record on a parent record's table in Knack using a filtered view inside a modal, without adding any fields to the parent table.
What You'll Learn
This article shows how to display the most recent child record value by adding a link on the parent table that opens a modal containing a single child record, sorted and limited to show only the latest entry.
This is the approach to use when users just need to see the most recent child record on demand. Nothing is stored on the parent, so there is no field maintenance. If you need the value for logic like email rules or filters, see Store the Most Recent Child Value Using Record Actions and Mapping Fields instead.
How It Works
You add a View Record Details action link to the parent's Table Element. That link creates a child details page. You convert the child page into a modal, then replace the default details element with a Table Element (or List Element) that pulls in the connected child records sorted by date descending and limited to one record.
When a user clicks the link on the parent table, a modal pops up showing the single most recent child record.
Example Scenario
You have a Contacts table and an Interactions table. Each Contact has many Interactions. On the main Contacts page, you want a "View Last Interaction" link next to each Contact that pops up the most recent Interaction's date and outcome in a modal.
Steps
1. Add a View Record Details Action to the Parent Table
Open the page that displays the parent Table Element (Contacts).
Click the Table Element to select it. In the right panel under Actions, click View Record Details. This adds a link column to the table and creates a child details page.
2. Rename the Link Column and Link Text
Click the new link column in the table. The right panel switches to the column's settings.
- Change the column heading to something descriptive (for example, Last Interaction).
- Change the link text to match (for example, View Last Interaction).
Save changes.
3. Convert the Child Page to a Modal
In the Pages panel on the left, click the new child page (it will be named something like Contact Details by default). Rename it if you want something more specific.
With the child page selected and no element selected in the canvas, the right panel shows page settings.
In the General tab, under Display, toggle on Display page as a modal.
You will also see an option Allow users to click outside the modal to close it. For display-only use cases like this one, toggle it on so users can dismiss the modal easily.
When to leave click-outside-to-close offIf the modal contains an edit form or other inputs, leave this setting off. Accidentally clicking outside could lose unsaved changes.
4. Remove the Default Details Element
When the child page was created, a Details Element for the parent record was added by default. Since this modal is only showing the most recent child record, delete that Details Element.
5. Add a Table Element for the Connected Child Records
Click the + button to add a new element to the page. Choose Table (or List, depending on the layout you prefer).
When prompted for the data source, select the child table (Interactions) and choose the option that shows records connected to this page's parent record.
Table or List — same settings either wayBoth Table and List Elements have the same right-panel sections (Title & Description, General Settings, Data Display, Actions, Styling). The sort, limit, filtering, and keyword search steps below work identically for both. Choose whichever layout looks better for your modal.
6. Configure Sort and Limit
With the new Table Element selected, open Data Display in the right panel, then click Settings.
Sort:
- Click the edit icon next to the current sort.
- Change the sort field to your date field (for example, Created On or Interaction Date).
- Set the direction to Newest to Oldest.
- Click Apply.
Limit:
- Toggle off Show all available records.
- Change the limit value to 1.
This ensures only the single most recent child record is displayed.
7. Clean Up the Element
Still in the Table Element settings, make a few adjustments so the modal is clean and focused.
In Data Display > Fields:
- Uncheck any fields you do not need to display.
- Keep only the fields relevant to the "most recent" summary (for example, Interaction Date and Outcome).
- Delete the default Edit and View action links if you do not need them.
In Data Display > Filtering:
- Toggle off Allow filtering.
In General Settings:
- Toggle off Keyword Search.
Filtering and search are unnecessary when the view only shows one record.
8. Customize the Title and Save
Back at the top of the Table Element settings, go to Title & Description and rename the element to something user-friendly (for example, Most Recent Interaction).
Click Save Changes.
9. Test in the Live App
Open the Live App. On the Contacts page, click the View Last Interaction link next to a Contact. A modal should pop up showing only that Contact's most recent Interaction.
Common Mistakes
- Leaving the default Details Element on the modal page. The modal will show parent details alongside the child record, which clutters the view.
- Forgetting to set the limit to 1. The modal will show all connected child records instead of just the most recent one.
- Sorting ascending instead of descending. The modal will show the oldest record instead of the newest.
- Leaving filtering and keyword search on. Users can accidentally filter themselves away from the single record.
Next Steps
- Store the Most Recent Child Value Using Record Actions and Mapping Fields if you need the value for email rules, filters, or other logic.
- Display Connected Child Records on a Parent Details Page if users would benefit from seeing the full history of child records instead of just the most recent.
- Display the Most Recent Child Record Value on a Parent Record for an overview of all three approaches and how to choose.
Updated 4 days ago
