With the 2025 Wave 2 release (BC 27), Microsoft Dynamics 365 Business Central introduces a new AL method: Rec.Truncate()
. This method is designed for high-performance data deletion, allowing you to quickly clear large datasets—ideal for testing, data resets, and periodic maintenance.
What Is Rec.Truncate()
?
Rec.Truncate()
is part of the Record API and enables bulk deletion of records in a single operation—bypassing slow row-by-row deletion like DeleteAll()
.
Key benefits:
Mass deletion with better performance
Honors filters applied by developers
Skips record-by-record processing
Bypasses security filters but still respects delete permissions
Main Features
Feature | Details |
---|---|
Filters support | Copies filtered data to a temp table, deletes, then restores |
AutoIncrement fields | Can be reset or preserved |
Flow control | Supports fallback to DeleteAll() on failure |
Fast and configurable | Ideal for large tables |
Limitations to Note
❌ Doesn’t support
OnDelete
triggers or event subscribers❌ Not usable on tables with Media or MediaSet fields
❌ Doesn’t handle FlowFields directly
🛠️ Use
try
blocks for safe fallback toDeleteAll()
Rec.Truncate()
vs DeleteAll()
Method | Pros | Cons |
---|---|---|
DeleteAll() | Simple, supports triggers | Slow on large tables |
Rec.Truncate() | Fast, efficient | Limited to trigger-free, non-media tables |
When Should You Use It?
Data resets in test environments
Cleaning up temporary or historical data
Improving performance in archive jobs
Final Thoughts
Rec.Truncate()
is a powerful enhancement for Business Central developers. It boosts performance for large-scale deletions and simplifies data management workflows. Add this to your toolkit for cleaner, faster, and more scalable AL solutions.
Stay tuned for more updates..!