Modifying data
Modifying data in AL covers the methods and table types used to change and work with records: Insert, Modify, Delete, temporary and virtual tables, filter pages, media on records, Dataverse table properties, and keeping test data between extension publishes. It answers how-to and syntax questions for these tasks.
Path: Development > Programming in the AL language > Tables and data > Modifying data · tier official · system development · narrative unreviewed (model text not yet checked)
Overview
This section groups AL pages about writing and shaping data in Business Central tables. The core page documents the Insert, Modify, ModifyAll, Delete, DeleteAll and Truncate methods, including syntax, return values and when Truncate is preferable to DeleteAll for bulk deletion.
Several pages describe special kinds of tables. Temporary tables are in-memory tables that reduce network and database load. Virtual tables are read-only and computed at runtime, with the Date and Integer virtual tables covered in their own pages. Other pages cover runtime filter pages built with FilterPageBuilder, media on records, enabling Dataverse tables for extension development, and retaining test data between publishes.
Start with the Insert, Modify and Delete page for the basic data operations. Then pick the page that matches your scenario, such as temporary tables for in-memory processing or the Date and Integer tables for reports and loops.
Key points
- Insert, Modify, ModifyAll, Delete, DeleteAll and Truncate are the AL methods for maintaining data. Truncate is the high-performance option for bulk deletion compared with DeleteAll.
- Temporary tables are in-memory tables. You can create them with the TableType property, temporary record variables, or the SourceTableTemporary page property.
- Virtual tables are read-only, computed at runtime and not stored in the database. They expose integers, dates, OS files, disk drives and database storage information.
- The Date virtual table (ID 2000000007) has fields for period type, start, end, number and name. It is used to filter and obtain date ranges for pages and reports.
- The Integer virtual table (ID 2000000026) holds integers from -1,000,000,000 to 1,000,000,000. It is filtered to control loops in reports.
- FilterPageBuilder creates runtime filter pages that set filters on multiple tables in a modal dialog. You add tables with the addtable method and records with the addrecord method.
- Media on records can be stored with the BLOB, Media or MediaSet data types. It can be shown in list pages with a tile layout, in card pages and in reports.
- The schemaUpdateMode setting in launch.json (Synchronize, Recreate, ForceSync) controls whether sample data is kept between extension publishes.
Learn pages
- Creating filter pages for filtering tables: Using the FilterPageBuilder data type to create a filter page in AL for Business Central.
- Date virtual table: The date virtual table in AL for Dynamics 365 Business Central
- Enabling Microsoft Dataverse Tables for Extension Development: This topic explains how to enable Microsoft Dataverse tables for the extension development process.
- Insert, Modify, ModifyAll, Delete, and DeleteAll Methods: Describes how to use the Insert, Modify, ModifyAll, Delete, and DeleteAll methods in Business Central
- Integer virtual table: The integer virtual table in AL for Dynamics 365 Business Central
- Synchronizing extension test data: Retaining table data after publishing an extension
- Temporary tables: Learn about temporary tables in AL for Business Central.
- In the observatory: Table 27 “Item”, Table 49 “Invoice Post. Buffer”
- Virtual tables: Virtual tables are system tables in AL for Dynamics 365 Business Central
- Working With Media on Records: Learn how to upload media, such as an image, to the database for displaying with records in the client.
Videos, posts and code changes
Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.
- #10055 Fix: migrating a document attachment deletes shared Tenant Media (code change): “Adds guard to prevent deletion of Tenant Media when other attachments”
- #10276 [master] Renewal Term field on the Create Contract Renewal Quote page does not accept the entered value such as 12M (code change): “Prevents overwriting of just-entered values with persistent record data”
- #10301 [Master]-Bug 646962: Withholding Tax Posting Setup (code change): “Restricts Calculation Base = Net to employee-only withholding taxes”
- #10447 [Bug][Subscription Billing] Price Update Template filters on Subscription Lines are overwritten by the proposal’s own default filters (code change): “Price Update Template filters on Subscription Lines are now correctly preserved”
- #10970 [Master] -SubBilling BillingLine doesn’t consider entries for usage date ranges crossing periods (code change): “Fixed subscription billing to correctly include usage data entries whose charge periods span”
- #11824 [29.x][Subscription Billing] Sales-Explode BOM fails for foreign-currency customers (code change): “Sales Subscription Line creation now correctly handles cached Sales Line data”
- #14135 [Job Queue] Don’t cancel the executed task when scheduling the next run (code change): “System Task ID is still cleared, and other task IDs are still cancelled”
- #14358 [29.x]- Edit in Excel insert fails on Price List Lines (Page 7001) — Unit of Measure Code validated before Product No. is set causing NavTestFieldException on Price Asset (Table 7003) (code change): “Inserting price list lines through Edit in Excel no longer fails with a Product No. error”
- #9712 [master] - Changing the contact of a Customer Subscription Contract doesn’t update the email of the contract. (code change): “Fixed missing email and phone number update when ‘Sell-to Contact No.’ is validated”
- #9850 Fix VariantCode lost during Contract Price Update proposal (code change): “Variant code from subscription header service object is now correctly passed”
- #133 Add TransferFields SkipFieldsNotMatchingType guidance (code change): “TransferFields only errors on type mismatches within the same extension”
- #209 3 AL/BC patterns: Insert/Delete trigger defaults on master data and declined Confirm in OnValidate (code change): “Record.Insert() and Delete() skip OnInsert and OnDelete by default”
- #264 knowledge(upgrade): clarify DataTransfer defaults and bypass safety (code change): “DataTransfer is preferred for equivalent field initialization and copies at any record count”
- #290 Attachment cleanup by document type (code change): “filtering by only table ID and number can inadvertently delete”
- Dynamics 365 Business Central: finally we’ll have TRUNCATE table in SaaS. (community post): “Rec.Truncate AL method to enable efficient bulk deletion of table rows”
- LockTimeoutDuration in AL (community post): “AL code can call Database.LockTimeoutDuration to raise or lower the lock timeout”
- Rec.Truncate in AL (community post): “Rec.Truncate is a new AL method based on SQL Server TRUNCATE”
- Dynamics 365 Business Central: How to insert a record with a specified SystemId in AL (community post): “insert a record with a specified SystemId in AL using the Insert(Boolean, Boolean) method”
- Business Central 2025 wave 2 (BC27): Truncating table data with new AL method (procedure Truncate) (community post): “Rec.Truncate AL method for efficiently deleting large volumes”
- Business Central 2026 release wave 2 (BC29): Check records for uncommitted changes (Added the IsDirty property to the Record API) (community post): “IsDirty property to check whether a record instance has uncommitted changes”
Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.
What Learn documents here 8 of 9 Learn pages
- learnCreating filter pages for filtering tables2023-03-31
- learnDate virtual table2025-01-08
- learnEnabling Microsoft Dataverse Tables for Extension Development2021-04-01
- learnInsert, Modify, ModifyAll, Delete, and DeleteAll Methods2025-09-30
- learnInteger virtual table2025-01-08
- learnSynchronizing extension test data2021-08-26
- learnTemporary tables2026-06-24
- learnVirtual tables2025-01-08