bcquality/microsoft/knowledge/error-handling/enabled-action-need-not-repeat-testfield.md
wenjiefan 198dbd8d59 Add page action Enabled false-positive guard
Document that an OnAction trigger need not duplicate a TestField check when the action's Enabled expression already prevents UI invocation with the field blank.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-08-17 11:27:41 +02:00

1.1 KiB

bc-version domain keywords technologies countries application-area
all
error-handling
page-action
onaction
enabled-expression
testfield
mandatory-field
ui-validation
false-positive
al
w1
all

An enabled expression can make a repeated TestField unnecessary in OnAction

Description

A page action's Enabled expression controls whether the user can invoke its OnAction trigger. When that expression requires a record field to be nonblank, the UI cannot invoke the action while the field is blank. Repeating the same presence check with TestField at the start of OnAction is therefore not required for that UI path.

Best Practice

Do not flag a missing TestField in OnAction when the action's Enabled expression already proves that the same field is nonblank before UI invocation. Require validation in shared business logic or other entry points that do not have the action's UI guard.

Anti Pattern

Recommending an unconditional duplicate TestField solely because OnAction uses the field, without accounting for an Enabled expression that prevents invocation while the field is blank.