bcquality/microsoft/knowledge/error-handling/fielderror-default-message-logic.bad.al
Jesper Schulz-Wedde c9d90ac605 Promote validated community knowledge
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
2026-07-14 14:14:07 +02:00

23 lines
851 B
AL

table 50120 "FieldError Default Bad"
{
fields
{
field(1; "No."; Code[20]) { }
field(2; "Discount %"; Decimal) { }
field(3; "Currency Code"; Code[10]) { }
}
procedure ValidateForRelease()
begin
// This re-tests a field and gives FieldError a fully formed sentence.
// The framework already prepends the caption and appends the value,
// so this renders as "Currency Code The Currency Code field must have
// a value. in ..." — caption repeated, capital letter mid-sentence,
// stray trailing clause.
if "Currency Code" = '' then
FieldError("Currency Code", 'The Currency Code field must have a value.');
if "Discount %" > 100 then
FieldError("Discount %", 'The Discount % must not be greater than 100 percent.');
end;
}