bcquality/microsoft/knowledge/events/add-new-event-parameters-at-the-end.md
Jesper Schulz-Wedde 23af51e02d Add P0 extensibility compatibility knowledge
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 645349fd-1892-48f3-8a84-db77d6abd1c3
2026-07-14 11:43:55 +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. For a local or internal Business or Integration event, subscribers may omit parameters, so a new parameter can be compatible when appended at the end. A public event is also a public procedure that dependent extensions can raise; adding a parameter to it is breaking and requires a new event. Existing parameters must never be renamed, removed, reordered, or have their type changed.

Best Practice

When extending an existing local or internal Business or Integration event, append the new parameter after all existing ones, including after a trailing var IsHandled: Boolean when present. Existing subscribers can continue omitting the new trailing parameter. Create a new event instead when the publisher procedure is public.

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

Anti Pattern

Inserting a new parameter before an existing parameter of a local or internal event, or adding any parameter to a public event. Detection: a changed event signature where a new parameter is not a compatible trailing addition.

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