{"id":1396,"date":"2024-01-24T06:49:01","date_gmt":"2024-01-24T06:49:01","guid":{"rendered":"https:\/\/www.aegissofttech.com\/insights\/?p=1396"},"modified":"2026-06-17T11:31:47","modified_gmt":"2026-06-17T11:31:47","slug":"hide-messages-in-sales-documents","status":"publish","type":"post","link":"https:\/\/www.aegissofttech.com\/insights\/hide-messages-in-sales-documents\/","title":{"rendered":"How to Hide Messages in Sales Documents in Business Central"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Sales documents in Business Central sometimes throw validation messages at the least convenient moments, such as the \u201cShipment Date is before Work Date\u201d alert.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While these prompts are meant to prevent errors, they can interrupt workflows and slow down data entry.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide offers a step-by-step approach with best practices to implement adjustments for smoother operations. Let\u2019s get started!<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Key Takeaways<\/strong><\/p>\n\n\n\n<div style=\"border:1px solid #000; padding:15px; margin:20px 0;\">\nFollow these instructions to hide messages in sales documents:\n<ul style=\"margin-top:10px; line-height:1.6;\">\n<li>Create a table extension for Sales Line to safely modify validation behavior without altering the base application.<\/li>\n<li>Modify the Shipment Date field validation by adding SetHideValidationDialog(true) in the OnBeforeValidate trigger.<\/li>\n<li>Add conditional logic to control when suppression applies, ensuring critical warnings still appear when needed.<\/li>\n<li>Test thoroughly in a sandbox environment with different sales scenarios to confirm the validation message is hidden only in the right cases.<\/li>\n<li>Deploy the extension using AL publish once testing is complete, and monitor the impact on sales document workflows.<\/li>\n<\/ul>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">What Triggers the Shipment Date Validation Message?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The \u201cShipment Date is before Work Date\u201d message appears when a sales line in <a href=\"https:\/\/www.aegissofttech.com\/insights\/what-is-microsoft-dynamics-business-central\/\" target=\"_blank\" rel=\"noreferrer noopener\">Dynamics 365 Business Central<\/a> has a Shipment Date earlier than the Work Date. This built-in check prevents potential scheduling conflicts and ensures data integrity.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This behavior can create user experience challenges:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Multiple dialogs appear when entering or editing several sales lines<\/li>\n\n\n\n<li>Repeated clicks interrupt workflow and increase the chances of errors<\/li>\n\n\n\n<li>Bulk data entry or automated imports can become cumbersome<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">HideValidationDialog and Related Methods<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When you connect with a <a href=\"https:\/\/www.aegissofttech.com\/dynamics-365\/business-central-consulting\" target=\"_blank\" rel=\"noreferrer noopener\">Business Central consultant<\/a>, they educate you on how you can hide messages in sales documents<strong><em>.<\/em><\/strong> The platform also highlights the ways to control how alerts appear on sales lines.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s a closer look:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What HideValidationDialog Does on Sales Line<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For instance, in the Sales Line table, the SetHideValidationDialog procedure is used to suppress validation dialogs. Here\u2019s an example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>procedure SetHideValidationDialog(NewHideValidationDialog: Boolean)\nbegin\n    HideValidationDialog := NewHideValidationDialog;\n    OnAfterSetHideValidationDialog(Rec, NewHideValidationDialog);\nend;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This procedure sets the HideValidationDialog variable to the specified Boolean value, controlling whether validation dialogs are shown.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">SetHideValidationDialog Boolean Toggle<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To suppress the \u201cShipment Date is before Work Date\u201d 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s how you can implement this in a table extension:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tableextension 50001 \"SalesLineExt\" extends \"Sales Line\"\n{\n    fields\n    {\n        modify(\"Shipment Date\")\n        {\n            trigger OnBeforeValidate()\n            begin\n                Rec.SetHideValidationDialog(true);\n            end;\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">GetHideValidationDialog and Other Guard Logic<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The GetHideValidationDialog function checks the current value of the HideValidationDialog flag. If it\u2019s TRUE, validation dialogs are suppressed. Additionally, the HasBeenShown variable is used to ensure that the validation message is shown only once per session.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s an example of how these are used in the Sales Line table:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>local procedure CheckShipmentDateBeforeWorkDate()\nvar\n    IsHandled: Boolean;\nbegin\n    IsHandled := false;\n    OnBeforeCheckShipmentDateBeforeWorkDate(Rec, xRec, HasBeenShown, IsHandled);\n    if IsHandled then\n        exit;\n    if (\"Shipment Date\" &lt; WorkDate()) and HasTypeToFillMandatoryFields() then\n        if not (GetHideValidationDialog() or HasBeenShown) and GuiAllowed then begin\n            Message(\n                Text014,\n                FieldCaption(\"Shipment Date\"),\n                \"Shipment Date\",\n                WorkDate());\n            HasBeenShown := true;\n        end;\nend;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this code, the CheckShipmentDateBeforeWorkDate procedure checks if the Shipment Date is before the Work Date.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If so, it verifies whether the validation dialog should be shown based on the HideValidationDialog flag and the HasBeenShown variable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step-by-Step Guide: How to Hide the Message with AL Code<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Follow these steps to <strong><em>hide messages in sales documents <\/em><\/strong>with <a href=\"https:\/\/www.aegissofttech.com\/insights\/business-central-al-code\/\" target=\"_blank\" rel=\"noreferrer noopener\">AL code in Business Central<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step #1: Create a Table Extension for the Sales Line<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To begin, you\u2019ll need to extend the Sales Line table to customize its behavior.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add custom logic to the Sales Line table. Then, create a table extension.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tableextension 50100 \"SalesLine Hide Dialog Ext\" extends \"Sales Line\"\n{\n    fields\n    {\n        \/\/ Custom fields can be added here if needed\n    }\n\n    \/\/ Triggers and procedures will be added in the next steps\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This extension allows you to modify the behavior of the Sales Line table without altering the base application code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step #2: Modify the \u201cShipment Date\u201d Field Validation<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Next, you\u2019ll modify the validation logic for the Shipment Date field to suppress the validation dialog.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use the SetHideValidationDialog procedure in the OnBeforeValidate trigger.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>modify(\"Shipment Date\")\n{\n    trigger OnBeforeValidate()\n    begin\n        Rec.SetHideValidationDialog(true);\n    end;\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step #3: Ensure Proper Context for Suppression<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It\u2019s crucial to ensure that the suppression of the validation dialog occurs in the appropriate context.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Implement logic to determine when to suppress the dialog.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trigger OnBeforeValidate()\nbegin\n    if ShouldSuppressValidation then\n        Rec.SetHideValidationDialog(true);\nend;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, ShouldSuppressValidation is a boolean variable that determines whether the validation dialog should be suppressed. You\u2019ll need to define the logic for this condition based on your specific requirements.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step #4: Test the Implementation<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Example test case\nSalesLine.\"Shipment Date\" := WorkDate() - 1;\nSalesLine.Validate(\"Shipment Date\");<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step #5: Deploy the Extension<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once testing is complete and the functionality is verified, deploy the extension to your Business Central environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The \u201cal publish\u201d 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.<\/p>\n\n\n\n<section class=\"call-to-action-section\">\n<div class=\"call-to-action-container\">\n<div class=\"call-to-action-body\">\n<div class=\"cta-title\"><\/div>\n<p><\/p>\n<div style=\"text-align:center; color:white;\">\n<strong>Also Read:<\/strong> <a href=\"https:\/\/www.aegissofttech.com\/insights\/ai-for-business-central-developers\/\" target=\"_blank\">The Ultimate Guide to AI for Business Central Developers<\/a><\/div>\n<p><\/p>\n<\/div>\n<\/div>\n<\/section>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices and Considerations to Hide Messages in Sales Documents<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Follow these best practices to maintain data integrity and smooth workflows in Business Central:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>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.<\/li>\n\n\n\n<li>Ensure that disabling the dialog does not hide critical warnings. Always verify that essential checks, like incorrect pricing or mandatory fields, remain visible.<\/li>\n\n\n\n<li>Keep version compatibility in mind. Microsoft may change default validation behavior in future Business Central updates, so review your customizations whenever upgrading.<\/li>\n\n\n\n<li>Test all changes thoroughly in a sandbox environment before deploying to production. This allows you to confirm that the hide messages in sales documents<strong><em> <\/em><\/strong>functionality works as intended without unintended side effects.<\/li>\n<\/ul>\n\n\n\n<section class=\"call-to-action-section\">\n<div class=\"call-to-action-container\">\n<div class=\"call-to-action-body\">\n<div class=\"cta-title\"><\/div>\n<p><\/p>\n<div style=\"text-align:center; color:white;\">\n<strong>Also Read:<\/strong> <a href=\"https:\/\/www.aegissofttech.com\/insights\/hide-messages-in-purcase-documents-business-central\/\" target=\"_blank\">How to Add Hide Messages in Purchase Documents<\/a><\/div>\n<p><\/p>\n<\/div>\n<\/div>\n<\/section>\n\n\n\n<h2 class=\"wp-block-heading\">Risks and Trade-Offs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Hiding validation messages can improve workflow efficiency, but it comes with trade-offs that you need to consider:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Transparency loss: <\/strong>Missing critical validations can lead to errors or data inconsistencies<\/li>\n\n\n\n<li><strong>Maintenance overhead: <\/strong>Updating Business Central may require adjustments to AL code to maintain expected behavior<\/li>\n\n\n\n<li><strong>Unexpected behavior: <\/strong>Suppressing messages can affect document processing, posting, or downstream reporting<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Streamline Sales Document Workflows Safely<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">At <a href=\"https:\/\/www.aegissofttech.com\" target=\"_blank\" rel=\"noreferrer noopener\">Aegis Softtech<\/a>, 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our approach reduces workflow friction while maintaining accurate sales data and reporting.<\/p>\n\n\n    \t<section class=\"call-to-action-section\">\n    \t\t<div class=\"call-to-action-container\">\n    \t\t\t<div class=\"call-to-action-body\">\n    \t\t\t\t<div class=\"cta-title\"><\/div>\n    \t\t\t\t<p><\/p>\n<div style='text-align:center; color:white;'>\n<a href='https:\/\/www.aegissofttech.com\/contact-us.html' target='_blank'>Contact us today<\/a> to see how we can optimize your Business Central environment!<\/div>\n<p><\/p>\n    \t\t\t<\/div>\n    \t\t\t    \t\t<\/div>\n    \t<\/section>\n    \n\n\n\n<h2 class=\"wp-block-heading\">FAQs<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. How do you hide validation messages in sales documents for the shipment date?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You hide them by setting HideValidationDialog to true or using the SetHideValidationDialog method for the sales line.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. What is HideValidationDialog \/ SetHideValidationDialog in BC Sales Line?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">HideValidationDialog is a property that tells BC not to show validation messages. SetHideValidationDialog is a method to turn this on or off in code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Are there downsides to hiding validation dialogs in sales documents?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, users might enter incorrect data, which can break processes like invoicing or shipment, making errors harder to spot.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":" ","protected":false},"author":9,"featured_media":19595,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[124],"tags":[294],"class_list":["post-1396","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-business-central","tag-hide-messages-in-sales-documents"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts\/1396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/comments?post=1396"}],"version-history":[{"count":7,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts\/1396\/revisions"}],"predecessor-version":[{"id":19913,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts\/1396\/revisions\/19913"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/media\/19595"}],"wp:attachment":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/media?parent=1396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/categories?post=1396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/tags?post=1396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}