Hide – “Shipment Date xx/xx/xx is before work date xx/xx/xx” note
Step-by-Step Guide: Hide Messages in Sales Documents When Validating Shipment Date:
Build a Sales Order and validate the Shipment Date with a too-early date of workdate.
Here, the Workdate is 09/12/2023 and I put on a timely Shipment Date i.e. 09/05/2023.
*** The proof/monitory message will be shown only when an item is validated in the Sales Line, not while Shipment Date validation.
Validation Dialog when the Shipment Date is earlier than the Workdate.
I attempt with the My Business Central setup page.
Go to Business Central Web Client -> click on Setup
Snap-on modified when I collected notifications and explored for Workdate prompt. Turn off the allowed button and try again.
Sales Method
Sales System – with Shipment Date too early than Workdate.
Smooth acquired the message – Shipment Date 09/05/23 is before workdate 09/12/23.
Allow dig into the language now.
In Sales underline, I explored with – before the work date and set up the under label Text014.
Text014: Label ‘%1 %2 is before work date %3’;
Search with – Text014 in Sales underLine and you can notice that Text014 is used in an event named “CheckShipmentDateBeforeWorkDate”
local procedure CheckShipmentDateBeforeWorkDate()
var
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeCheckShipmentDateBeforeWorkDate(Rec, xRec, HasBeenShown, IsHandled);
if IsHandled then
exit;
if ("Shipment Date"< WorkDate()) and HasTypeToFillMandatoryFields() then
if not (GetHideValidationDialog() or HasBeenShown) and GuiAllowed then begin
Message(
Text014,
FieldCaption("Shipment Date"), "Shipment Date", WorkDate());
HasBeenShown := true;
end;
end;
So the core process to hide the message is the “GetHideValidationDialog” function
If we can set HideValidationDialog as true, we can pass over the message here. Let’s find the method!
Adept is a procedure to set the value of HideValidationDialog called “SetHideValidationDialog”
procedure SetHideValidationDialog(NewHideValidationDialog: Boolean)
begin
HideValidationDialog := NewHideValidationDialog;
OnAfterSetHideValidationDialog(Rec, NewHideValidationDialog);
end;
We are required to set the value as true before the Shipment date is validated and so the preferred utilizes the OnBeforeValidate activate of Shipment Date control to hide this dialog.
tableextension 50001 "SalesLineExt" extends "Sales Line"
{
fields
{
modify("Shipment Date")
{
trigger OnBeforeValidate()
begin
Rec.SetHideValidationDialog(true);
end;
}
}
}
If HideValidationDialog is true –
we can at present pass over the message statement –
“Shipment Date 09/05/23 is prior to work date 09/12/23.”
Conclusion
Ultimately, the best approach depends on your specific needs and context. Weigh the risks and benefits carefully before choosing to hide validation messages in Business Central services.
Remember, prioritizing transparency with customers is crucial in most situations. Consider alternative communication channels to inform them of any concerns regarding the shipment date without cluttering the sales document.