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.
ApplicationArea = Basic, Suite;
Caption = 'Generate Packing Slip';
ToolTip = 'Generates a packing slip with no pricing or scheduled ship date.';
today := today();
date_lim := calcdate('-2D', today);
if PackSlip then begin
BlankShipDate_Enabled := True;
message('today ' + format(today, 0, '<Month,2>/<Day,2>/<Year4>'));
message('date_lim ' + format(date_lim, 0, '<Month,2>/<Day,2>/<Year4>'));
message('post date ' + format(post_date, 0, '<Month,2>/<Day,2>/<Year4>'));
message('post date #2 ' + format(SalesHeader."Posting Date", 0, '<Month,2>/<Day,2>/<Year4>'));
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!');
BlankShipDate_Enabled := False;
ShipDate_Enabled := False;
BlankShipDate := False;
Welcome to DUG!
You do not have access to the SalesHeader table from the request page. The request page is just for filtering etc.
You need to do this in the actual report code in the OnAfterGetRecord trigger.
Hi Erik, thank you for the quick reply. Your response confirms what I suspected/feared. I've made a new boolean variable and declared as [InDataSet]. I have several OnAfterGetRecord triggers, the one that I did try (at the end of all the fields/columns for the report) did not work. In there I am comparing dates and setting the boolean to either false or true and then checking on that boolean in my request page. I set the boolean to true in OnInit().
Is there a way to accomplish what I am seeking to do? On my Sales Order Confirmation I give the user an option to "Generate Packing Slip" and would like to send a warning only if their posting date is outside of a few days +/- of today.