DataTransfer type causing runtime errors
The DataTransfer type speeds up AL upgrade code, but two cases fail at runtime with no compiler warning: AddConstantValue with literal values on Code fields, later fixed in platform builds 27.0.44405 and 26.0.44406, and AddSourceFilter on FlowFields, FlowFilters or Media fields. The workaround for the first is a Code variable; for the second, write the upgrade without DataTransfer using SetRange and ModifyAll.

post The BC Docs Librarian
"The DataTransfer data type is great for improving AL upgrade code performance."
Key points
- DataTransfer.AddConstantValue fails when assigning constants directly to Code fields; use a Code variable instead as a workaround
- DataTransfer.AddSourceFilter does not support FlowFields, FlowFilters, or Media type fields; fall back to traditional SetRange and ModifyAll methods
- These issues may be fixed in future platform builds; the first issue was resolved in platform 27.0.44405 and 26.0.44406
- AL compiler does not warn about these problems before runtime execution
Quotes
- “The DataTransfer data type is great for improving AL upgrade code performance.” (Establishes the value of DataTransfer while introducing the undocumented limitations that follow)
Heads up
- gotcha: “When assigning a constant value to a Code field, then don’t write your code as follows” (about other DataTransfer)
- gotcha: “Do not filter on FlowFields, FlowFilters, or fields of the Media data type” (about other DataTransfer)
Context
- Features: DataTransfer type, AddConstantValue method, AddSourceFilter method
- Versions: 27.0.44405, 26.0.44406
Source: The BC Docs Librarian, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.