Business Central 2025 wave 2 (BC27): Truncating table data with new AL method (procedure Truncate)
Business Central 2025 Wave 2 introduces the new Rec.Truncate AL method for efficiently deleting large volumes of table data in a single operation. This method improves performance over row-by-row DeleteAll operations by locking the table during the transaction, with configurable AutoIncrement behavior and delete permission checks, though it has several limitations including incompatibility with temporary tables, try functions, security filters, and tables with media fields.

post Dynamics 365 Lab
"The new Rec.Truncate method in AL provides a powerful and efficient way to delete large volumes of data from a table."
Key points
- Rec.Truncate (BC27) deletes all records in the current filter range far faster than row-by-row deletion, but locks the whole table until commit, so concurrency is lower than with DeleteAll.
- Optional parameters let you check whether truncation is unsupported for the table and choose whether AutoIncrement fields reset to 0 or keep their prior value; delete permissions are enforced.
- Not supported for temporary, system or non-Normal tables, inside try functions, with security filters, with filters on flow fields or many marked records, when OnBeforeDelete/OnAfterDelete are subscribed, or with Media/MediaSet fields; use DeleteAll there.
- With filters the platform copies data to a temporary table and back, so filtering only pays off when most rows are deleted; the author saw runtime errors when filtering or using FindSet on large deletions.
Quotes
- “The new Rec.Truncate method in AL provides a powerful and efficient way to delete large volumes of data from a table.” (Establishes the core value proposition of the feature for bulk data cleanup operations)
- “Truncate with a filter should only be used when the majority of the table is being deleted, as otherwise DeleteAll will be more efficient.” (Critical guidance for developers on when to apply this method to avoid performance degradation with filters)
- “Truncate allows for less concurrency than DeleteAll, as the entire table will be locked until the transaction is committed.” (Important trade-off consideration showing the performance benefit comes at the cost of table-level locking)
Heads up
- gotcha: “Truncate allows for less concurrency than DeleteAll, as the entire table will be locked until the transaction is committed.” (about version BC27)
- gotcha: “Truncate with a filter should only be used when the majority of the table is being deleted, as otherwise DeleteAll will be more efficient.” (about version BC27)
- warning: “Truncate is not supported when the OnBeforeDelete and/or OnAfterDelete event is subscribed.” (about OnBeforeDelete, OnAfterDelete, version BC27)
- warning: “Truncate is not supported when the field has Media and/or MediaSet fields.” (about version BC27)
Context
- Features: Truncate method, bulk data deletion, AutoIncrement control, delete permissions, table locking, filter support
- Versions: BC27, 2025 Wave 2
Source: Dynamics 365 Lab - Yun Zhu, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.