Dynamic Business Central 365: Handling Partial Imports with AutoUpdate and AutoReplace in XMLports
In the previous blog, we understood the conceptual difference between AutoUpdate and AutoReplace and how these properties influence data during XMLport imports. While the theory is important, the real clarity comes when we see these properties working in AL code with actual data.
In this blog, we will extend that understanding by walking through a complete working example in AL, including:
-
A custom table to store demo data
-
A list page to visualize imported records
-
Two XMLports:
-
One using AutoUpdate
-
One using AutoReplace
-
-
Importing partial data and observing the output behavior
This hands-on example will clearly show how Business Central treats missing and empty fields during import.
Demo Scenario Overview
We will work with a simple custom table that contains the following fields:
-
No. (Primary Key)
-
Description
-
Unit Cost
-
Blocked
The goal is to import only Unit Cost values from an external file and observe what happens to the other fields when:
-
AutoUpdate is enabled
-
AutoReplace is enabled
Custom Table Definition
The following table will act as our target for the import:
List Page to Observe Results
This page allows us to easily see how records change after each import:
XMLport Using AutoUpdate (Partial Update)
This XMLport updates only the fields present in the file, leaving all other data untouched:
XMLport Using AutoReplace (Full Replace)
This XMLport treats the import file as the complete definition of the record:
Testing Result:
First, create or verify that records already exist in the KR Import Demo table.
We will use an Import.csv file that contains the primary key and the new unit cost values.
We will run the following actions from the page:
-
Import Prices (AutoUpdate)
-
Import Prices (AutoReplace)
Click the required import action (AutoUpdate or AutoReplace).
Upload the Import.csv file.
Review the updated records in the list page.
Result with AutoUpdate
Unit Cost is updated
Description and Blocked remain unchanged
This is the recommended approach for partial imports, such as price updates.
Result with AutoReplace
Unit Cost is updated
Description is cleared
Blocked resets to its InitValue
This behavior is expected and demonstrates why AutoReplace must be used with caution.
Key Learning from the Example
-
AutoUpdate is ideal when importing partial data
-
AutoReplace should be used only when the import file contains all required fields
-
Empty or missing fields behave very differently depending on the chosen property
-
Testing in a sandbox environment is essential before running imports in production
Thanks for reading! 😊
Regards,
Khushbu Rajvi
This was originally posted here.

Like
Report
*This post is locked for comments