Hi All,
On a page, there are two fields - 'From Date' and 'To Date'.
Whenever 'From Date' is filled and 'To Date' is made empty after filling a value, then wrong validation error is thrown.
How to overcome this ?
Below is the AL code -
field(50103; FromDate; Date)
{
DataClassification = ToBeClassified;
Caption = 'From Date';
NotBlank = true;
trigger OnValidate()
var
myInt: Integer;
begin
if (No_Series = '') then // *** added for autopopulate series
No_Series := 'JDCODE';
end;
}
field(50104; ToDate; Date)
{
DataClassification = ToBeClassified;
Caption = 'To Date';
NotBlank = true;
trigger OnValidate()
begin
begin
if (No_Series = '') then // *** added for autopopulate series
No_Series := 'JDCODE';
end;
IF ("FromDate" > "ToDate") then
Error('Cannot be earlier than "From Date"');
end;
}
Please suggest !