bcquality/microsoft/knowledge/performance/calcfields-in-both-getrecord-triggers-is-not-redundant.md
wenjiefan 9cc5627f42 Move false-positive guards from skills into knowledge files
Keep review skills slim (finders/appliers). The FP guards and released-baseline preconditions previously embedded in leaf skills become negative-clarification knowledge articles in their domains, and the agent-findings policy edits to al-ui/al-privacy are reverted to main. Adds 6 knowledge files: error-handling (page-boolean-triggers-default-to-true), ui (bound-page-field-inherits-source-field-tooltip), performance (calcfields-in-both-getrecord-triggers-is-not-redundant, page-effective-filter-may-live-outside-the-diff), breaking-changes (unreleased-symbol-change-is-not-a-breaking-change), upgrade (unreleased-schema-change-needs-no-upgrade-path).
2026-07-17 09:58:16 +02:00

1.4 KiB

bc-version domain keywords technologies countries application-area
all
performance
calcfields
onaftergetrecord
onaftergetcurrrecord
page-lifecycle
flowfield
false-positive
al
w1
all

CalcFields in both OnAfterGetRecord and OnAfterGetCurrRecord is not redundant

Description

OnAfterGetRecord fires once per row as the page loads records into the view; OnAfterGetCurrRecord fires when a record becomes the active/current record. Calling CalcFields in both triggers is not duplicate or redundant work: the two triggers run at different points in the page lifecycle and serve different purposes — populating FlowFields for every displayed row versus refreshing them for the record the user has selected. The same CalcFields call appearing in both places is an intentional pattern, not copy-paste waste.

Best Practice

Do not flag CalcFields appearing in both OnAfterGetRecord and OnAfterGetCurrRecord as duplicate, redundant, or removable. Treat each trigger's CalcFields on its own lifecycle merits.

Anti Pattern

Recommending that a developer delete one of the two CalcFields calls because "the field is already calculated in the other trigger". The genuine per-row FlowField cost is addressed by the separate guidance on FlowField calculation in loops and on hidden FlowFields; it is not addressed by removing a lifecycle-correct CalcFields.