mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 09:26:52 +01:00
Move eight net-new rules into the Microsoft layer, remove six overlapping articles, and update review skill discovery and references. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0b130227-d418-4bc0-9e7d-ec6a37adf039
27 lines
860 B
AL
27 lines
860 B
AL
table 50122 "FieldError vs TestField Good"
|
|
{
|
|
fields
|
|
{
|
|
field(1; "No."; Code[20]) { }
|
|
field(2; "Posting Date"; Date) { }
|
|
field(3; "Amount"; Decimal) { }
|
|
}
|
|
|
|
procedure PostDocument()
|
|
begin
|
|
// TestField performs this simple presence check and raises only when
|
|
// the field is empty. Self-documenting prerequisite.
|
|
TestField("Posting Date");
|
|
|
|
// Business logic has already determined the value is invalid;
|
|
// FieldError raises a tailored, record-aware message with no
|
|
// condition of its own.
|
|
if IsAmountOutsideAllowedRange("Amount") then
|
|
FieldError("Amount", 'is outside the approved posting range');
|
|
end;
|
|
|
|
local procedure IsAmountOutsideAllowedRange(Value: Decimal): Boolean
|
|
begin
|
|
exit((Value < 0) or (Value > 1000000));
|
|
end;
|
|
}
|