mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-06 07:06:54 +01:00
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
30 lines
1.1 KiB
AL
30 lines
1.1 KiB
AL
// Demonstration-only AL. Not compiled by CI; illustrates the article.
|
|
codeunit 50240 "IsHandled Init Good Sample"
|
|
{
|
|
procedure ApplyDiscounts(var SalesHeader: Record "Sales Header")
|
|
var
|
|
DiscountPct: Decimal;
|
|
HeaderIsHandled: Boolean;
|
|
PaymentIsHandled: Boolean;
|
|
begin
|
|
// Each fresh local is false and belongs to one non-looping raise.
|
|
OnBeforeApplyHeaderDiscount(SalesHeader, DiscountPct, HeaderIsHandled);
|
|
if not HeaderIsHandled then
|
|
DiscountPct := 5;
|
|
|
|
// Handling the header event does not suppress this independent seam.
|
|
OnBeforeApplyPaymentDiscount(SalesHeader, DiscountPct, PaymentIsHandled);
|
|
if not PaymentIsHandled then
|
|
DiscountPct += 2;
|
|
end;
|
|
|
|
[IntegrationEvent(false, false)]
|
|
local procedure OnBeforeApplyHeaderDiscount(var SalesHeader: Record "Sales Header"; var DiscountPct: Decimal; var IsHandled: Boolean)
|
|
begin
|
|
end;
|
|
|
|
[IntegrationEvent(false, false)]
|
|
local procedure OnBeforeApplyPaymentDiscount(var SalesHeader: Record "Sales Header"; var DiscountPct: Decimal; var IsHandled: Boolean)
|
|
begin
|
|
end;
|
|
}
|