mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 17:36:53 +01:00
Transaction and error handling in BC AL - new knowledge articles
This commit is contained in:
parent
7dd3f4777d
commit
4ce7d816cc
19 changed files with 415 additions and 10 deletions
|
|
@ -0,0 +1,27 @@
|
|||
codeunit 50149 "Sec Sample CommitBeh Good"
|
||||
{
|
||||
[CommitBehavior(CommitBehavior::Ignore)]
|
||||
[IntegrationEvent(true, false)]
|
||||
procedure OnBeforeApplyingDiscount(var Customer: Record Customer)
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure ApplyDiscount(var Customer: Record Customer)
|
||||
begin
|
||||
Customer."Customer Price Group" := 'VIP';
|
||||
Customer.Modify(true);
|
||||
OnBeforeApplyingDiscount(Customer);
|
||||
if Customer."Credit Limit (LCY)" <= 0 then
|
||||
Error('Customer %1 not eligible', Customer."No.");
|
||||
Commit();
|
||||
end;
|
||||
}
|
||||
|
||||
codeunit 50150 "Sec Sample CommitBeh Good Sub"
|
||||
{
|
||||
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Sec Sample CommitBeh Good", 'OnBeforeApplyingDiscount', '', true, true)]
|
||||
local procedure NotifyOther(var Customer: Record Customer)
|
||||
begin
|
||||
Commit();
|
||||
end;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue