🕐 Remember When Lists Could Sort By Any Key? 🔄
A developer creates a solution to sort Business Central list pages by any predefined table key, not just single fields. The pattern uses temporary metadata storage, dynamic RecordRef reflection, and page extensions to offer flexible multi-field sorting that restores functionality from the NAV/C/SIDE era.

post Gerardo Rentería Blog
"Every BC table has predefined keys designed for optimal data retrieval and sorting."
Key points
- Tables in Business Central have predefined keys optimized for data retrieval; the solution leverages these keys to enable sorting by multiple fields in order.
- The architecture consists of a temporary table for metadata, a codeunit using RecordRef to read table keys, and a selection page that lets users choose which key to sort by.
- When a user selects a sort order, a new list window opens with the applied sorting, while the original remains unchanged.
- Page extensions add a ‘Change Sort Order’ action to any list page, making the feature reusable across tables like Customer and Sales Order.
- The solution includes example extensions and permission set configuration for integration into daily Business Central workflows.
Quotes
- “Every BC table has predefined keys designed for optimal data retrieval and sorting.” (Explains why leveraging table keys instead of arbitrary field combinations makes sense for performance and intentional sorting patterns.)
- “After selecting the desired key, a new customer list window will open with the additional key title.” (Shows that the solution preserves the original view while opening a separate sorted view, allowing users to compare sort orders without losing context.)
AL objects mentioned
As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.
- table “GDRG Table Key”
- codeunit “GDRGKeyManager”
- page “GDRG Key Selection”
- page 22 “Customer List”
- permissionset “GDRGKeyManager”
Not found in BC28-30: table “GDRG Table Key”, codeunit “GDRGKeyManager”, page “GDRG Key Selection”, permissionset “GDRGKeyManager”.
Possibly related
No source states these links: they share an object, a model read them, or a person found the same subject.
- All new goodies about AL Namespace in BC 2025 wave 2 — possibly related: both name Page 22 “Customer List”
- Business Central v29: System Audit Fields Now Available in Analysis Mode — possibly related: both name Page 22 “Customer List”
- Dynamics 365 Business Central: Convert Word (.docx) To PDF (.pdf) within BC (No control add-in and APIs) — possibly related: both name Page 22 “Customer List”
- Dynamics 365 Business Central: How to add a new menu to the Role Center — possibly related: both name Page 22 “Customer List”
- Dynamics 365 Business Central: How to get current Profile (Role) info (Profile ID, Display Name, Source, Role Center ID, etc.) via AL — possibly related: both name Page 22 “Customer List”
- Dynamics 365 Business Central: How to hide/disable New, Edit (Edit List), and Delete actions on the page — possibly related: both name Page 22 “Customer List”
- Dynamics 365 Business Central: How to quickly get User Experience/Experience Tier (Essential or Premium) in AL — possibly related: both name Page 22 “Customer List”
- Dynamics 365 Business Central: How to quickly identify the first transaction date and the number of days since the last sale with a customer — possibly related: both name Page 22 “Customer List”
- Dynamics 365 Business Central: How to substitute a page for another page via AL — possibly related: both name Page 22 “Customer List”
- Dynamics 365 Business Central: How to use Page.SetSelectionFilter Method in temporary records — possibly related: both name Page 22 “Customer List”
Context
- Features: custom sort orders, table key reflection, multi-field sorting, page extensions, dynamic table opening, selection dialog
Source: Gerardo Renteria, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.