bcquality/microsoft/knowledge/performance/skip-setloadfields-on-write-and-transferfields.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.9 KiB

bc-version domain keywords technologies countries application-area
all
performance
setloadfields
partial-record
jit-load
modify
insert
transferfields
write-path
al
w1
all

Skip SetLoadFields on write and copy paths

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

Description

SetLoadFields is a read optimization. The platform's partial-record usage guidelines list the operations that require every field to already be present: Insert, Delete, Rename, TransferFields, and copying a record into a temporary table. When those operations run on a partial record, the platform issues a just-in-time load of the missing fields. That extra round-trip costs more than loading the full row on the original FindSet or Get. Note: Modify itself is not in this list — a Modify(false) that only touches loaded fields is safe with a partial record.

Best Practice

Omit SetLoadFields on loops whose body performs a documented full-load operation (Insert, Delete, Rename, TransferFields, or assignment into a temporary record) on the same record variable, so the initial read already materializes every field those operations need.

See sample: skip-setloadfields-on-write-and-transferfields.good.al.

Anti Pattern

Calling SetLoadFields immediately before a FindSet whose body performs Delete, Rename, TransferFields, or copies the record into a temporary table. The review signal is a partial-record setup on a record variable that feeds one of these documented full-load operations in the same iteration.

See sample: skip-setloadfields-on-write-and-transferfields.bad.al.