BC Friday Tips #10 Use SetLoadFields to partially load data from a table
Happy Friday! Time for our weekly BCFridayTips for the msdyn365bc developers!
Use SetLoadFields to partially load data from a table.
Why?
✅ Improve Performance. Fetching only the necessary fields can significantly improve performance, particularly when dealing with table extensions.
However, remember that its usage should be limited to read transactions. Using it for write transactions would be counter-productive because the write transaction requires the record to be fully loaded.
It’s also recommended not to use it when executing multiple queries on the same table with varying field sets, like Setup Tables. In such cases, loading all fields and utilising cached data for subsequent queries is more efficient.