🕐 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”.
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.