AL Partial Records: Review the Fields Before You Fetch
On this page
AL partial records deserve a field-by-field review before a performance change reaches a Business Central sandbox. A short loading list is useful only when it matches what the complete read path needs.
This guide is for an AL developer reviewing a read-only loop. It provides a practical way to document field dependencies, check helper routines, and preserve evidence for the next reviewer. The review framework is Bitta Apps engineering guidance. Product behavior is linked to Microsoft's current method references. No benchmark result or customer outcome is claimed.
Start with the business result, then define the read path
Choose a bounded operation before changing its record access. Write down what the operation produces, which records it includes, and how the team will recognize the same result after the change. A report total, an export value, or a diagnostic listing needs a clear comparison target.
Identify the original filters, ordering, environment, extension versions, and execution identity. Keep representative test data anonymous. Record the current behavior before optimizing anything; otherwise a later timing comparison can accidentally compare different work.
Microsoft's SetLoadFields reference says the method replaces the fields selected for initial loading. It accepts normal fields, rather than FlowFields or FlowFilters. A later call can therefore change a loading decision made earlier in the same record's path.
Put the proposed selection beside the required output. Do not choose fields from the visible loop alone. Include helper routines, conditional branches, formatting decisions, and diagnostic messages. Ask the author to explain the dependencies instead of accepting a smaller list as evidence of an improvement.
Create a field dependency sheet
Use a simple review note with a row for each field the operation reads. For every row, record the reason it is needed, the routine that reads it, whether the read is unconditional, and who owns that routine. The sheet is an engineering aid, not a generated guarantee of correctness.
Walk the happy path first, then deliberately inspect paths that are easy to miss: an empty description, a different reporting option, an error message, or a helper that formats output. An apparently cosmetic field read still belongs in the dependency review.
Microsoft documents AddLoadFields as adding to the selected initial fields without replacing earlier selections. That makes the distinction between adding and replacing important when several routines prepare the same record.
During review, mark every place that changes the loading selection. Keep the responsibility clear: either the caller supplies the helper's requirements, or the design explicitly provides another arrangement. Avoid a situation where the caller and helper each assume the other has accounted for a field.
Inspect the call boundary, not just the loop body
Microsoft's partial records guidance explains that reading an unloaded field triggers an additional just-in-time load. Passing a record by value can leave repeated iterations needing that extra load because the copy does not update the original enumerator.
Review how the record crosses each helper boundary. Compare the helper's field needs with the caller's initial selection. A routine that looks inexpensive in isolation may deserve attention when it is invoked repeatedly by a loop.
Do not mechanically replace every value parameter with a reference parameter. Review the helper's actual contract, including whether it changes record state. A performance adjustment should preserve the caller's intended behavior. If the helper is shared, find its other callers before changing that contract.
Keep dependency review separate from measurement. For a broader investigation of an expensive transaction, use the posting performance diagnosis guide. This checklist addresses field loading in a bounded read path; it does not replace investigation of locks, external requests, or business validation.
Make deliberate checks where loading matters
The AreFieldsLoaded reference provides a check for whether the specified fields are currently loaded. It is a useful diagnostic question when inspecting assumptions at a call boundary.
When a later load is intentional, Microsoft's LoadFields reference documents explicit loading and error handling. It loads requested fields not already loaded, giving the developer a deliberate place to handle a failed load.
Treat these methods as tools for understanding the chosen design. Do not scatter checks into every helper without a reason. Write down where a later load is expected, why it is acceptable, and what the operation should do if it cannot complete. An unexplained extra read remains a review question.
The partial records guidance also describes consistency failures when data changes between the initial read and a later load. Test an operation's response to changing data in a controlled sandbox. Do not turn off checks or silently continue with mixed assumptions to make a performance experiment appear successful.
Compare results before accepting a faster run
Build a repeatable sandbox scenario around the same input and business result. Include ordinary data and the conditional paths identified in the dependency sheet. Use the AL test automation guide when turning those scenarios into regression coverage.
Check functional output before comparing elapsed time. Then inspect the relevant call path and data access evidence. Keep a written record of what changed and what stayed equivalent. Report measured results from the actual environment; do not borrow a documentation example's improvement as the expected benefit for this extension.
A read-only candidate is the starting point for this checklist. If the workflow also writes, transfers fields, or copies records, review those operations separately against the current documentation. A small initial selection is not a universal optimization for every record operation.
A review checklist the next developer can reuse
Define equivalence. Identify the output, selection criteria, and test evidence that must remain the same.
Trace field reads. Include helpers, conditional branches, messages, and formatting.
Trace loading decisions. Review both replacement and additive selection calls.
Inspect parameter boundaries. Check field requirements and record-state responsibilities together.
Document later loads. Explain intentional loading and the expected error response.
Validate in a sandbox. Compare functional results before recording performance evidence.
Preserve the review. Attach the dependency sheet, relevant versions, and observed results to the change.
Carry this review forward when a helper or output requirement changes. A field selection should describe today's complete read path, with evidence another developer can follow. If a specific extension needs a focused review, book a call with Bitta Apps.
Frequently asked questions
Does a shorter field selection prove the operation is faster?
No. Compare equivalent functional output and measured data access in the actual sandbox scenario before accepting the change.
Should every record parameter become a var parameter?
No. Review the helper contract and its state changes before altering parameter behavior. An optimization must preserve the caller’s intended semantics.
Is this a universal checklist for write routines?
No. It starts with a bounded read-only path. Review writes, field transfers and copies separately against the applicable documentation.
Sources
Claims in this article were checked against the following on Oct 8, 2026.
- learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-setloadfields-method
- learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-addloadfields-method
- learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-partial-records
- learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-arefieldsloaded-method
- learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-loadfields-method