Transaction and error handling in BC AL - new knowledge articles

This commit is contained in:
Volodymyr Dvernytskyi 2026-04-23 20:58:02 +03:00
parent 7dd3f4777d
commit 4ce7d816cc
19 changed files with 415 additions and 10 deletions

View file

@ -0,0 +1,17 @@
codeunit 50156 "Perf Sample TryFunc Bad"
{
procedure ApplyDiscountAttempt(var Customer: Record Customer)
begin
if not TryApplyDiscount(Customer) then
Message('Discount not applied');
end;
[TryFunction]
local procedure TryApplyDiscount(var Customer: Record Customer)
begin
Customer.Validate("Customer Price Group", 'VIP');
Customer.Modify(true);
if Customer."Credit Limit (LCY)" <= 0 then
Error('Customer %1 not eligible', Customer."No.");
end;
}