Sales documents in Business Central sometimes throw validation messages at the least convenient moments, such as the “Shipment Date is before Work Date” alert.
While these prompts are meant to prevent errors, they can interrupt workflows and slow down data entry.
There are ways to take control and hide messages in sales documents without bypassing important checks. Business Central offers the SetHideValidationDialog method, and AL code extensions provide a clean way to customize behavior at the table level.
This guide offers a step-by-step approach with best practices to implement adjustments for smoother operations. Let’s get started!
Key Takeaways
- Create a table extension for Sales Line to safely modify validation behavior without altering the base application.
- Modify the Shipment Date field validation by adding SetHideValidationDialog(true) in the OnBeforeValidate trigger.
- Add conditional logic to control when suppression applies, ensuring critical warnings still appear when needed.
- Test thoroughly in a sandbox environment with different sales scenarios to confirm the validation message is hidden only in the right cases.
- Deploy the extension using AL publish once testing is complete, and monitor the impact on sales document workflows.
What Triggers the Shipment Date Validation Message?
The “Shipment Date is before Work Date” message appears when a sales line in Dynamics 365 Business Central has a Shipment Date earlier than the Work Date. This built-in check prevents potential scheduling conflicts and ensures data integrity.
By default, the system shows a warning prompt whenever this condition occurs. Users must acknowledge it before proceeding, which works well for occasional edits but can slow down operations when processing multiple lines.
This behavior can create user experience challenges:
- Multiple dialogs appear when entering or editing several sales lines
- Repeated clicks interrupt workflow and increase the chances of errors
- Bulk data entry or automated imports can become cumbersome
HideValidationDialog and Related Methods
When you connect with a Business Central consultant, they educate you on how you can hide messages in sales documents. The platform also highlights the ways to control how alerts appear on sales lines.
Here’s a closer look:
What HideValidationDialog Does on Sales Line
In Business Central, the HideValidationDialog is a global flag that controls the display of validation messages. Specifically, the SetHideValidationDialog procedure sets this flag, and the GetHideValidationDialog function retrieves its value. These are defined in various tables, including the Sales Line table.
For instance, in the Sales Line table, the SetHideValidationDialog procedure is used to suppress validation dialogs. Here’s an example:
procedure SetHideValidationDialog(NewHideValidationDialog: Boolean)
begin
HideValidationDialog := NewHideValidationDialog;
OnAfterSetHideValidationDialog(Rec, NewHideValidationDialog);
end;This procedure sets the HideValidationDialog variable to the specified Boolean value, controlling whether validation dialogs are shown.
SetHideValidationDialog Boolean Toggle
To suppress the “Shipment Date is before Work Date” message, you can set HideValidationDialog to TRUE before the validation occurs. This is typically done in the OnBeforeValidate trigger of the Shipment Date field in a table extension.
Here’s how you can implement this in a table extension:
tableextension 50001 "SalesLineExt" extends "Sales Line"
{
fields
{
modify("Shipment Date")
{
trigger OnBeforeValidate()
begin
Rec.SetHideValidationDialog(true);
end;
}
}
}GetHideValidationDialog and Other Guard Logic
The GetHideValidationDialog function checks the current value of the HideValidationDialog flag. If it’s TRUE, validation dialogs are suppressed. Additionally, the HasBeenShown variable is used to ensure that the validation message is shown only once per session.
Here’s an example of how these are used in the Sales Line table:
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;In this code, the CheckShipmentDateBeforeWorkDate procedure checks if the Shipment Date is before the Work Date.
If so, it verifies whether the validation dialog should be shown based on the HideValidationDialog flag and the HasBeenShown variable.
Step-by-Step Guide: How to Hide the Message with AL Code
Follow these steps to hide messages in sales documents with AL code in Business Central.
Step #1: Create a Table Extension for the Sales Line
To begin, you’ll need to extend the Sales Line table to customize its behavior.
Add custom logic to the Sales Line table. Then, create a table extension.
tableextension 50100 "SalesLine Hide Dialog Ext" extends "Sales Line"
{
fields
{
// Custom fields can be added here if needed
}
// Triggers and procedures will be added in the next steps
}This extension allows you to modify the behavior of the Sales Line table without altering the base application code.
Step #2: Modify the “Shipment Date” Field Validation
Next, you’ll modify the validation logic for the Shipment Date field to suppress the validation dialog.
Use the SetHideValidationDialog procedure in the OnBeforeValidate trigger.
modify("Shipment Date")
{
trigger OnBeforeValidate()
begin
Rec.SetHideValidationDialog(true);
end;
}Step #3: Ensure Proper Context for Suppression
It’s crucial to ensure that the suppression of the validation dialog occurs in the appropriate context.
Implement logic to determine when to suppress the dialog.
trigger OnBeforeValidate()
begin
if ShouldSuppressValidation then
Rec.SetHideValidationDialog(true);
end;In this example, ShouldSuppressValidation is a boolean variable that determines whether the validation dialog should be suppressed. You’ll need to define the logic for this condition based on your specific requirements.
Step #4: Test the Implementation
After implementing the changes, thoroughly test the functionality to ensure that the validation dialog is suppressed as expected. Perform tests with various scenarios to confirm the behavior.
// Example test case
SalesLine."Shipment Date" := WorkDate() - 1;
SalesLine.Validate("Shipment Date");In this test case, setting the Shipment Date to a date before the Work Date should trigger the validation. With the suppression logic in place, the validation dialog should not appear.
Step #5: Deploy the Extension
Once testing is complete and the functionality is verified, deploy the extension to your Business Central environment.
The “al publish” command publishes the extension to your Business Central environment. Ensure that you have the necessary permissions and that the environment is prepared for the deployment.
Best Practices and Considerations to Hide Messages in Sales Documents
Follow these best practices to maintain data integrity and smooth workflows in Business Central:
- Consider hiding validation dialogs only when it makes sense, such as during bulk imports, integrations, or specific user workflows. Suppressing messages in everyday scenarios can lead to missed alerts.
- Ensure that disabling the dialog does not hide critical warnings. Always verify that essential checks, like incorrect pricing or mandatory fields, remain visible.
- Keep version compatibility in mind. Microsoft may change default validation behavior in future Business Central updates, so review your customizations whenever upgrading.
- Test all changes thoroughly in a sandbox environment before deploying to production. This allows you to confirm that the hide messages in sales documents functionality works as intended without unintended side effects.
Risks and Trade-Offs
Hiding validation messages can improve workflow efficiency, but it comes with trade-offs that you need to consider:
- Transparency loss: Missing critical validations can lead to errors or data inconsistencies
- Maintenance overhead: Updating Business Central may require adjustments to AL code to maintain expected behavior
- Unexpected behavior: Suppressing messages can affect document processing, posting, or downstream reporting
Streamline Sales Document Workflows Safely
Validation messages in Business Central can disrupt workflows and affect data integrity. Learning how to hide messages in sales documents allows teams to cut interruptions, speed up data entry, and handle bulk operations or Business Central integrations without skipping essential checks.
At Aegis Softtech, we help clients implement these BC customizations safely and effectively. We create clean AL extensions, test them in sandbox environments, and document every change so your Business Central processes stay reliable.
Our approach reduces workflow friction while maintaining accurate sales data and reporting.
FAQs
1. How do you hide validation messages in sales documents for the shipment date?
You hide them by setting HideValidationDialog to true or using the SetHideValidationDialog method for the sales line.
2. What is HideValidationDialog / SetHideValidationDialog in BC Sales Line?
HideValidationDialog is a property that tells BC not to show validation messages. SetHideValidationDialog is a method to turn this on or off in code.
3. Are there downsides to hiding validation dialogs in sales documents?
Yes, users might enter incorrect data, which can break processes like invoicing or shipment, making errors harder to spot.



