{"id":1284,"date":"2024-01-17T06:08:58","date_gmt":"2024-01-17T06:08:58","guid":{"rendered":"https:\/\/www.aegissofttech.com\/insights\/?p=1284"},"modified":"2026-03-20T10:00:26","modified_gmt":"2026-03-20T10:00:26","slug":"hide-messages-in-purchase-documents","status":"publish","type":"post","link":"https:\/\/www.aegissofttech.com\/insights\/hide-messages-in-purchase-documents\/","title":{"rendered":"How to hide messages in Purchase Documents while validating Order Date"},"content":{"rendered":"<p><strong>Hide &#8211; \u201cOrder Date xx\/xx\/xx is earlier than the work date xx\/xx\/xx\u201d message<\/strong><\/p>\n<h2>Hide messages in Purchase Documents:<\/h2>\n<p>Create a purchase order and validate the order date with an earlier work date.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-1285 size-full aligncenter\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/1-img.jpg\" alt=\"Create a Purchase Order \" width=\"624\" height=\"320\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/1-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/1-img-300x154.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/p>\n<p>In this case, the workdate is 09\/12\/2023 and I add an earlier Order Date i.e. 09\/11\/2023.<\/p>\n<p>*** The validation\/warning message will be shown only when an item is validated in the Purchase Line, not during Order Date validation.<\/p>\n<p>Validation Dialog when Order Date is earlier than the work date.<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1286 size-full aligncenter\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/2-img.jpg\" alt=\"Validation Dialog \" width=\"624\" height=\"241\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/2-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/2-img-300x116.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><br \/>\nI tried with <a href=\"https:\/\/learn.microsoft.com\/en-us\/dynamics365\/business-central\/ui-personalization-manage\" target=\"_blank\" rel=\"noopener\">My BC settings page<\/a>.<\/p>\n<p>Go to BC Web Client -&gt; click on Settings<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1287 size-full alignnone\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/0-img.jpg\" alt=\"BC Web Client \" width=\"624\" height=\"144\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/0-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/0-img-300x69.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1288 size-full alignleft\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/4-img.jpg\" alt=\"BC Settings\" width=\"217\" height=\"284\" title=\"\"><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1289 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/5-img.jpg\" alt=\"BC Setting1\" width=\"446\" height=\"281\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/5-img.jpg 446w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/5-img-300x189.jpg 300w\" sizes=\"(max-width: 446px) 100vw, 446px\" \/><br \/>\nClick on <strong>Change when I receive notifications<\/strong> and search for Workdate Reminder. Turn off the Enabled button and try again.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1290 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/6-img.jpg\" alt=\"receive notifications \" width=\"624\" height=\"313\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/6-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/6-img-300x150.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/p>\n<p>Purchase Order \u2013 with Order Date earlier than Workdate.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1291 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/7-img.jpg\" alt=\"Purchase order\" width=\"624\" height=\"320\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/7-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/7-img-300x154.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><br \/>\n<strong>Still got the message \u2013<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1292 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/8-img.jpg\" alt=\"got message\" width=\"624\" height=\"216\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/8-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/8-img-300x104.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/p>\n<p>Let\u2019s dig into the code now.<\/p>\n<p>In Purchase Line, I searched with \u2013 earlier than the work date and found the below label Text018.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1293 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/9-img.jpg\" alt=\"label Text018\" width=\"624\" height=\"216\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/9-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/9-img-300x104.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/p>\n<p>Text018: Label &#8216;%1 %2 is earlier than the work date %3.&#8217;;<\/p>\n<p><strong>Search with<\/strong> \u2013 Text018 in the Purchase Line and you can see that Text018 is used in a function named \u201cShowEarlyOrderDateMessage\u201d<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1294 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/10-img.jpg\" alt=\"Search with\" width=\"624\" height=\"211\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/10-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/10-img-300x101.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/p>\n<p><code>local procedure ShowEarlyOrderDateMessage()<br \/>\nvar<br \/>\nShowMessage: Boolean;<br \/>\nbegin<br \/>\nShowMessage := not (HideValidationDialog or HasBeenShown) and GuiAllowed;<br \/>\nOnShowEarlyOrderDateMessageOnAfterCalcShowMessage(Rec, ShowMessage);<br \/>\nif ShowMessage then begin<br \/>\nMessage(Text018, FieldCaption(\"Order Date\"), \"Order Date\", WorkDate());<br \/>\nHasBeenShown := true;<br \/>\nend;<br \/>\nend;<\/code><\/p>\n<p>\u201cShowEarlyOrderDateMessage()\u201d is called from the Order Date OnValidate trigger of the Purchase Line.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1295 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/11-img.jpg\" alt=\"field label\" width=\"624\" height=\"389\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/11-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/11-img-300x187.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/p>\n<p>So the key procedure to hide the message is \u201cShowEarlyOrderDateMessage()\u201d<\/p>\n<p>There are two ways to Hide\/Ignore the validation message.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1296 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/12-img.jpg\" alt=\"validation message\" width=\"624\" height=\"211\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/12-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/12-img-300x101.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/p>\n<ul>\n<li>We can subscribe to the event before the message and then just set Showmessage as False.<\/li>\n<li>To use Hidevalidation Dialog as it is a protected variable.<\/li>\n<\/ul>\n<p>Subscribing event \u201cOnShowEarlyOrderDateMessageOnAfterCalcShowMessage\u201d<br \/>\ncodeunit 50101 EventSubscriberManagement<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1297 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/13-img.jpg\" alt=\"EventSubscriberManagement \" width=\"624\" height=\"117\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/13-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/13-img-300x56.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><br \/>\n<code>{<br \/>\n[EventSubscriber(ObjectType::Table, Database::\"Purchase Line\", OnShowEarlyOrderDateMessageOnAfterCalcShowMessage, '', false, false)]<br \/>\nlocal procedure OnShowEarlyOrderDateMessageOnAfterCalcShowMessage(PurchaseLine: Record \"Purchase Line\"; var ShowMessage: Boolean);<br \/>\nbegin<br \/>\nShowMessage := false;<br \/>\nend;<br \/>\n}<\/code><\/p>\n<h3>Using HideValidationDialog<\/h3>\n<p><strong>Protected variable:<\/strong><\/p>\n<p>Protected variables are variables that you can access from a dependent extension. It has only any effect on the extension object. Only a global variable can be accessed from an extension if it is under the Protected Var segment.<\/p>\n<p>Here, we have HideValidationDialog which is a protected variable and can be extended in a table extension.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1298 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/14-img.jpg\" alt=\"table extension\" width=\"431\" height=\"184\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/14-img.jpg 431w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/14-img-300x128.jpg 300w\" sizes=\"(max-width: 431px) 100vw, 431px\" \/><br \/>\nTableExtension to access variable HideValidationDialog.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1299 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/15-img.jpg\" alt=\"\" width=\"624\" height=\"346\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/15-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/15-img-300x166.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><br \/>\n<code>tableextension 50100 PurchaseLineExt extends \"Purchase Line\"<br \/>\n{<br \/>\nfields<br \/>\n{<br \/>\nmodify(\"Order Date\")<br \/>\n{<br \/>\ntrigger OnBeforeValidate()<br \/>\nbegin<br \/>\nHideValidationDialog := true;<br \/>\nend;<br \/>\n}<br \/>\n}<br \/>\n}<\/code><\/p>\n<p>If HideValidationDialog is true or ShowMessage is false &#8211;<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1300 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/16-img.jpg\" alt=\"ShowMessage \" width=\"624\" height=\"211\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/16-img.jpg 624w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/16-img-300x101.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><br \/>\nwe can now ignore the message saying \u2013<\/p>\n<p>\u201c<strong>Order Date xx\/xx\/xx is earlier than the work date xx\/xx\/xx<\/strong>\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1301 size-full\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/17-img.jpg\" alt=\"work date\" width=\"617\" height=\"317\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/17-img.jpg 617w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/01\/17-img-300x154.jpg 300w\" sizes=\"(max-width: 617px) 100vw, 617px\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>In <a href=\"https:\/\/www.aegissofttech.com\/microsoft-dynamics-365-business-central.html\" target=\"_blank\" rel=\"noopener\">Microsoft Dynamics 365 Business Central<\/a>, you can use validation rules and triggers to hide messages in purchase documents based on specific conditions, such as the order date. Below are general steps that you can follow to achieve this. Please note that the exact steps may vary based on your specific version of Business Central.<\/p>\n<p>The actual field names and events may vary based on your specific Business Central version and customization setup. Ensure you refer to the documentation for your version and consider consulting with your system administrator or <a href=\"https:\/\/www.aegissofttech.com\/microsoft\/business-central-developers.html\" target=\"_blank\" rel=\"noopener\"><strong>Hire Business Central Developers<\/strong><\/a>\u00a0for assistance.<\/p>\n","protected":false},"excerpt":{"rendered":" ","protected":false},"author":9,"featured_media":1303,"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":[266,267],"class_list":["post-1284","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-business-central","tag-hide-messages-in-purchase-documents","tag-validating-order-date"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts\/1284","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=1284"}],"version-history":[{"count":4,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts\/1284\/revisions"}],"predecessor-version":[{"id":18586,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts\/1284\/revisions\/18586"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/media\/1303"}],"wp:attachment":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/media?parent=1284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/categories?post=1284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/tags?post=1284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}