Hello, I am trying to display a simple message to the user to double check their posting date if it's older than 2 days when printing the report. I cannot seem to get access to the Posting Date from the Sales Header in order to do the date comparison. I have tried many different ways, this is where my code currently stands.
field(PackSlip; PackSlip)
{
ApplicationArea = Basic, Suite;
Caption = 'Generate Packing Slip';
ToolTip = 'Generates a packing slip with no pricing or scheduled ship date.';
trigger OnValidate()
var
today: date;
date_lim: date;
begin
today := today();
date_lim := calcdate('-2D', today);
if PackSlip then begin
BlankShipDate_Enabled := True;
message('today ' format(today, 0, '//'));
message('date_lim ' format(date_lim, 0, '//'));
message('post date ' format(post_date, 0, '//'));
message('post date #2 ' format(SalesHeader."Posting Date", 0, '//'));
if SalesHeader."Posting Date" <= date_lim then
message('Your Posting Date is older than 2 days, please ensure your Posting Date is set to date of shipment before printing!');
end
else begin
BlankShipDate_Enabled := False;
ShipDate_Enabled := False;
BlankShipDate := False;
end;
end;
}

Report
All responses (
Answers (