bcquality/microsoft/knowledge/performance/reset-clears-partial-record-selection.md
Jesper Schulz-Wedde 2b5550c346
Some checks failed
Validate knowledge index / validate-index (push) Has been cancelled
Validate AL review fixtures / validate-review-fixtures (push) Has been cancelled
Validate frontmatter and structure / validate (push) Has been cancelled
Improve partner onboarding and documentation navigation (#174)
Lead with a complete plugin quick start and add task-oriented usage, troubleshooting, customization, and contribution guides. Preserve the broader plugin framing, correct conflicting contract guidance, support Agents folder reviews, and align repository validation. Convert existing sample references to clickable links without changing knowledge rules.

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-09 17:31:03 +02:00

1.4 KiB

bc-version domain keywords technologies countries application-area
all
performance
reset
setloadfields
partial-record
load-selection
findset
al
w1
all

Reset and empty SetLoadFields restore a full-row load

Contributions welcome — open a PR to refine or extend this article.

Description

SetLoadFields(...) sticks to the record variable until something clears it. Reset() "changes fields select for loading back to all", and SetLoadFields() with no arguments does the same. A later FindSet or Get then materializes every normal field. Agents often place SetLoadFields first, then Reset to apply new filters, and assume the partial selection survives. It does not.

Best Practice

Call Reset (or empty SetLoadFields()) first when the variable must be reused, then call SetLoadFields with the fields the next read actually uses, then apply filters and read. After Reset, a new SetLoadFields is required; the previous list is gone.

See sample: reset-clears-partial-record-selection.good.al.

Anti Pattern

SetLoadFields(...) followed by Reset() (or by parameterless SetLoadFields()) and then FindSet without restoring the load list. The filters look correct; the SQL still selects every column.

See sample: reset-clears-partial-record-selection.bad.al.