mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-08 18:31:36 +01:00
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>
This commit is contained in:
parent
45c2b2f5ec
commit
54ddd8ecc2
12 changed files with 477 additions and 2 deletions
|
|
@ -0,0 +1,37 @@
|
|||
// Demonstration-only AL. Not compiled by CI; illustrates the article.
|
||||
codeunit 50220 "Shipping Charge Good Sample"
|
||||
{
|
||||
procedure CalculateShippingCharge(OrderAmount: Decimal) Charge: Decimal
|
||||
var
|
||||
IsHandled: Boolean;
|
||||
begin
|
||||
// Give extensions a sanctioned seam to replace the calculation, then
|
||||
// skip the default logic when a subscriber has handled it.
|
||||
OnBeforeCalculateShippingCharge(OrderAmount, Charge, IsHandled);
|
||||
if IsHandled then
|
||||
exit(Charge);
|
||||
|
||||
if OrderAmount >= 1000 then
|
||||
Charge := 0
|
||||
else
|
||||
Charge := 49;
|
||||
end;
|
||||
|
||||
[IntegrationEvent(false, false)]
|
||||
local procedure OnBeforeCalculateShippingCharge(OrderAmount: Decimal; var Charge: Decimal; var IsHandled: Boolean)
|
||||
begin
|
||||
end;
|
||||
}
|
||||
|
||||
codeunit 50221 "Shipping Charge Sub Good Sample"
|
||||
{
|
||||
// A partner replaces the flat rate with a contract-specific rule.
|
||||
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Shipping Charge Good Sample", 'OnBeforeCalculateShippingCharge', '', false, false)]
|
||||
local procedure ApplyContractRate(OrderAmount: Decimal; var Charge: Decimal; var IsHandled: Boolean)
|
||||
begin
|
||||
if IsHandled then
|
||||
exit;
|
||||
Charge := OrderAmount * 0.02;
|
||||
IsHandled := true;
|
||||
end;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue