{"id":1003,"date":"2026-11-04T08:30:00","date_gmt":"2026-11-04T13:30:00","guid":{"rendered":"https:\/\/www.dataflowsoln.com\/blog\/?p=1003"},"modified":"2026-11-04T08:30:00","modified_gmt":"2026-11-04T13:30:00","slug":"bad-orders-keep-getting-posted","status":"publish","type":"post","link":"https:\/\/dataflowsoln.com\/blog\/bad-orders-keep-getting-posted\/","title":{"rendered":"BC Teardown #3: Bad orders keep getting posted"},"content":{"rendered":"\n<h2>The pain<\/h2>\n<p>Orders ship without a shipping agent. Finance and the warehouse clean it up after the fact, every week.<\/p>\n<h2>Why it happens<\/h2>\n<p>The rule lives in a training document, not in the system. The old NAV fix was editing the posting codeunit, which breaks on every upgrade.<\/p>\n<h2>Before: The NAV way: edit base code<\/h2>\n<pre style=\"background:#0c182c;color:#e6ecf5;padding:20px 24px;border-radius:10px;overflow-x:auto;font-size:15px;line-height:1.55;\"><code>\/\/ Codeunit 80 \"Sales-Post\"\n\/\/ modified directly in C\/AL\n\n\/\/ Every Microsoft update:\n\/\/   merge conflicts\n\/\/   retest everything\n\/\/   or the check quietly disappears<\/code><\/pre>\n<h2>After: An event subscriber, base code untouched<\/h2>\n<pre style=\"background:#0c182c;color:#e6ecf5;padding:20px 24px;border-radius:10px;overflow-x:auto;font-size:15px;line-height:1.55;\"><code>codeunit 50110 \"DF Sales Checks\"\n{\n  [EventSubscriber(ObjectType::Codeunit,\n    Codeunit::\"Sales-Post\",\n    'OnBeforePostSalesDoc', '', false, false)]\n  local procedure CheckOrder(\n    var SalesHeader: Record \"Sales Header\")\n  begin\n    if SalesHeader.\"Document Type\" =\n      SalesHeader.\"Document Type\"::Order then\n      SalesHeader.TestField(\"Shipping Agent Code\");\n  end;\n}<\/code><\/pre>\n<h2>The result<\/h2>\n<p>Posting stops with a clear message before bad data gets in. The rule survives every BC update.<\/p>\n<p><strong>Tip:<\/strong> The same pattern works for purchase, transfer and warehouse posting events.<\/p>\n<p><a href=\"https:\/\/dataflowsoln.com\/blog\/wp-content\/uploads\/2026\/11\/BC-Teardown-3-carousel.pdf\" target=\"_blank\" rel=\"noopener\">Download this teardown as a PDF<\/a><\/p>\n<hr \/>\n<p><strong>Got a Business Central problem like this?<\/strong> Free 30 minute review of your setup. Senior Microsoft certified developers, and you talk to the person writing the code. <a href=\"https:\/\/www.dataflowsoln.com\/#contact\">Contact Dataflow Solutions<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Orders ship without a shipping agent. Finance and the warehouse clean it up after the fact, every week.<\/p>\n","protected":false},"author":2,"featured_media":13,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[3,9,13],"class_list":["post-1003","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bc-teardowns","tag-al","tag-business-central","tag-event-subscribers"],"_links":{"self":[{"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts\/1003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/comments?post=1003"}],"version-history":[{"count":1,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts\/1003\/revisions"}],"predecessor-version":[{"id":1025,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts\/1003\/revisions\/1025"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/media\/13"}],"wp:attachment":[{"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/media?parent=1003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/categories?post=1003"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/tags?post=1003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}