Address review guidance feedback

Preserve independent event seams, cover loop-carried handled state, strengthen checkpoint and UI-handler fixtures, and align DeleteAll fallback guidance.

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

Copilot-Session: 10646e50-2d8b-4cca-b02b-dfa78629e6a1
This commit is contained in:
wenjiefan 2026-08-18 14:09:11 +02:00
parent 5f1cff2fb6
commit ead337f9cb
11 changed files with 91 additions and 26 deletions

View file

@ -4,19 +4,18 @@ codeunit 50240 "IsHandled Init Good Sample"
procedure ApplyDiscounts(var SalesHeader: Record "Sales Header")
var
DiscountPct: Decimal;
IsHandled: Boolean;
HeaderIsHandled: Boolean;
PaymentIsHandled: Boolean;
begin
// A freshly declared local Boolean is false.
OnBeforeApplyHeaderDiscount(SalesHeader, DiscountPct, IsHandled);
if IsHandled then
exit;
DiscountPct := 5;
// Each fresh local is false and belongs to one non-looping raise.
OnBeforeApplyHeaderDiscount(SalesHeader, DiscountPct, HeaderIsHandled);
if not HeaderIsHandled then
DiscountPct := 5;
// Reaching this point proves that IsHandled is still false.
OnBeforeApplyPaymentDiscount(SalesHeader, DiscountPct, IsHandled);
if IsHandled then
exit;
DiscountPct += 2;
// Handling the header event does not suppress this independent seam.
OnBeforeApplyPaymentDiscount(SalesHeader, DiscountPct, PaymentIsHandled);
if not PaymentIsHandled then
DiscountPct += 2;
end;
[IntegrationEvent(false, false)]