Fix lifecycle compatibility guidance (#93)

* Fix lifecycle compatibility guidance

Correct high-confidence Business Central guidance and samples for upgrade tags, collectible errors, trigger semantics, obsoletion, events, interfaces, API contracts, and test transactions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e05a43e7-6448-4d67-9c73-798523f5d945

* Address guidance review findings

Gate SecretText guidance to BC23 and clarify that the collectible-error sample intentionally emits a message-only blocking aggregate.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e05a43e7-6448-4d67-9c73-798523f5d945

---------

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
This commit is contained in:
Jesper Schulz-Wedde 2026-07-14 11:26:16 +02:00 committed by GitHub
parent aca3986fd0
commit 5706959e4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 201 additions and 104 deletions

View file

@ -8,9 +8,9 @@ codeunit 50291 "New OnBefore Bad Sample"
begin
Total := 100;
// Anti-pattern: IsHandled was bolted onto the existing
// OnAfterCalculateTotal, changing its contract and breaking every
// subscriber that matched the original signature.
// Anti-pattern: IsHandled was bolted onto the existing OnAfter event.
// Regardless of compiler compatibility, this changes a notification
// into an override contract that existing subscribers did not expect.
OnAfterCalculateTotal(SalesHeader, Total, IsHandled);
end;

View file

@ -8,13 +8,13 @@ codeunit 50260 "Reuse Event Good Sample"
IsHandled := false;
// A single event, extended with CustomerNo appended at the end, covers
// the need; no second event is raised beside it.
OnBeforeProcessOrder(SalesHeader, CustomerNo, IsHandled);
OnBeforeProcessOrder(SalesHeader, IsHandled, CustomerNo);
if IsHandled then
exit;
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeProcessOrder(var SalesHeader: Record "Sales Header"; CustomerNo: Code[20]; var IsHandled: Boolean)
local procedure OnBeforeProcessOrder(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean; CustomerNo: Code[20])
begin
end;
}

View file

@ -20,13 +20,14 @@ codeunit 50225 "Reservation Post Good Sample"
var
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeReserve(ReservationEntry, IsHandled);
if IsHandled then
exit;
ReservationEntry.Reserved := true;
ReservationEntry.Modify(true);
if not IsHandled then begin
ReservationEntry.Reserved := true;
ReservationEntry.Modify(true);
end;
// OnAfter reports completion whether a subscriber or the base body handled it.
OnAfterReserve(ReservationEntry);
end;

View file

@ -7,6 +7,7 @@ codeunit 50220 "Shipping Charge Good Sample"
begin
// Give extensions a sanctioned seam to replace the calculation, then
// skip the default logic when a subscriber has handled it.
IsHandled := false;
OnBeforeCalculateShippingCharge(OrderAmount, Charge, IsHandled);
if IsHandled then
exit(Charge);