bcquality/microsoft/knowledge/events/publish-thin-onbefore-onafter-integration-events.good.al
Jesper Schulz-Wedde 54ddd8ecc2 Add events knowledge domain and review leaf skill
Add a new `events` knowledge domain covering AL events & subscribers,
wired into the AL review pipeline.

- 3 atomic articles (+ .good.al/.bad.al samples) under
  microsoft/knowledge/events/: the IsHandled override pattern, thin
  OnBefore/OnAfter integration-event publishers, and static vs manual
  subscribers.
- New leaf skill microsoft/skills/review/al-events-review.md sourcing the
  events domain.
- Wired into microsoft/skills/review/al-code-review.md (sub-skills + Source
  + description) and README.md (leaf-skill count + domain list).

AL event syntax verified against Microsoft Learn. Samples are
demonstration-only (not compiled by CI). Additive change; no contract change.

Part of #34.

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

43 lines
1.2 KiB
AL

// Demonstration-only AL. Not compiled by CI; illustrates the article.
table 50224 "Reservation Entry Sample"
{
fields
{
field(1; "Entry No."; Integer) { }
field(2; "Item No."; Code[20]) { }
field(3; Quantity; Decimal) { }
field(4; Reserved; Boolean) { }
}
keys
{
key(PK; "Entry No.") { Clustered = true; }
}
}
codeunit 50225 "Reservation Post Good Sample"
{
procedure Reserve(var ReservationEntry: Record "Reservation Entry Sample")
var
IsHandled: Boolean;
begin
OnBeforeReserve(ReservationEntry, IsHandled);
if IsHandled then
exit;
ReservationEntry.Reserved := true;
ReservationEntry.Modify(true);
OnAfterReserve(ReservationEntry);
end;
// Thin publishers: empty bodies, the calling routine owns the logic.
[IntegrationEvent(false, false)]
local procedure OnBeforeReserve(var ReservationEntry: Record "Reservation Entry Sample"; var IsHandled: Boolean)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnAfterReserve(var ReservationEntry: Record "Reservation Entry Sample")
begin
end;
}