bcquality/microsoft/knowledge/events/add-new-event-parameters-at-the-end.md
Jesper Schulz-Wedde 8fc4199492 Soften Anti Pattern wording in add-new-event-parameters article
Remove the last name-vs-position misconception from the Anti Pattern so it
is consistent with the corrected Description: mid-list insertion is framed
as noisy and harder to review rather than as forcing subscriber re-mapping.
Detection sentence unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-25 11:59:00 +02:00

1.4 KiB

bc-version domain keywords technologies countries application-area
all
events
event-parameters
signature
backward-compatibility
append
onbefore
integration-event
versioning
al
w1
all

Add new event parameters at the end

Description

Adding a parameter to an existing event publisher changes its signature. Appending the new parameter at the end of the parameter list keeps the change easy to review and track: existing subscribers still bind to the leading parameters, and the diff is a single clean addition. Inserting a parameter in the middle makes diffs noisy and harder to review, and obscures the history of how the signature evolved. New parameters belong after the existing ones.

Best Practice

When extending an existing publisher, append the new parameter after all existing ones, including after a trailing var IsHandled: Boolean when present. Subscribers that already match keep working against the leading parameters, and the change stays a one-line addition that is trivial to review.

See sample: add-new-event-parameters-at-the-end.good.al.

Anti Pattern

Inserting a new parameter in the middle of an existing event's signature, shifting every subsequent parameter and making the change noisy and harder to review. Detection: a changed event signature where an added parameter appears before existing parameters rather than at the tail of the list.

See sample: add-new-event-parameters-at-the-end.bad.al.