bcquality/microsoft/knowledge/performance/prefer-modifyall-over-per-row-modify.md
Jesper Schulz-Wedde b6da405376 Improve partner onboarding and documentation navigation
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: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-09 17:25:29 +02:00

1.7 KiB

bc-version domain keywords technologies countries application-area
all
performance
modifyall
deleteall
bulk
loop
modify
set-based
al
w1
all

Use ModifyAll only for equivalent bulk assignments

Description

ModifyAll assigns one value to one field across the filtered set. It does not run the field's OnValidate trigger. Its optional RunTrigger parameter controls the table OnModify trigger, not field validation. Replacing a loop is therefore correct only when direct assignment is semantically equivalent for every row.

Best Practice

Use ModifyAll when the loop directly assigns the same value, does not call Validate, needs no per-row calculation, and does not depend on OnModify unless the equivalent RunTrigger value is supplied. Check whether table trigger code, related subscribers, security filtering, Media/MediaSet, or companion fields force row-by-row fallback (see triggers-and-media-field-regress-modifyall.md). A visible loop for progress UX is acceptable only when evidence shows the equivalent bulk call already executes as individual operations and the loop preserves trigger and business semantics.

See sample: prefer-modifyall-over-per-row-modify.good.al.

Anti Pattern

A loop that only assigns a constant and calls Modify(false) on a field with no validation side effects or bulk fallback condition. A progress dialog alone does not exempt this loop. Conversely, replacing Validate(Field, Value); Modify(true) with ModifyAll(Field, Value) is also an anti-pattern because it silently drops field validation and may drop table-trigger behavior.

See sample: prefer-modifyall-over-per-row-modify.bad.al.