{"id":1014,"date":"2026-11-19T08:30:00","date_gmt":"2026-11-19T13:30:00","guid":{"rendered":"https:\/\/www.dataflowsoln.com\/blog\/?p=1014"},"modified":"2026-11-19T08:30:00","modified_gmt":"2026-11-19T13:30:00","slug":"you-fixed-the-bug-in-1-of-7-places","status":"publish","type":"post","link":"https:\/\/dataflowsoln.com\/blog\/you-fixed-the-bug-in-1-of-7-places\/","title":{"rendered":"BC Teardown #14: You fixed the bug. In 1 of 7 places."},"content":{"rendered":"<p><em>Copy and paste is fast. Right up until the bug report.<\/em><\/p>\n\n<h2>The pain<\/h2>\n<p>The same rule was copied into seven pages. It changed, someone updated three of them, and now they disagree.<\/p>\n<h2>Why it happens<\/h2>\n<p>Duplicated logic means every change has to be found and repeated by hand, and something always gets missed.<\/p>\n<h2>Before: Copied everywhere<\/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>\/\/ Customer Card\nif Rec.\"Credit Limit (LCY)\" &gt; 50000 then\n  Rec.TestField(\"Payment Terms Code\");\n\n\/\/ Plus 6 more copies across pages,\n\/\/ with 3 different limits<\/code><\/pre>\n<h2>After: One procedure, one place<\/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 50180 \"DF Credit Rules\"\n{\n  procedure CheckTerms(Customer: Record Customer)\n  begin\n    if Customer.\"Credit Limit (LCY)\" &gt; 50000 then\n      Customer.TestField(\"Payment Terms Code\");\n  end;\n}\n\n\/\/ Everywhere else:\nCreditRules.CheckTerms(Customer);<\/code><\/pre>\n<h2>The result<\/h2>\n<p>Change the rule once and every page follows. Fewer bugs, faster changes, easier updates.<\/p>\n<p><strong>Tip:<\/strong> Better yet, move the 50,000 limit into a setup table. See Monday&#8217;s teardown.<\/p>\n<p><a href=\"https:\/\/dataflowsoln.com\/blog\/wp-content\/uploads\/2026\/11\/BC-Teardown-14-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>Copy and paste is fast. Right up until the bug report.<\/p>\n","protected":false},"author":2,"featured_media":46,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[3,9,11],"class_list":["post-1014","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bc-teardowns","tag-al","tag-business-central","tag-clean-code"],"_links":{"self":[{"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts\/1014","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=1014"}],"version-history":[{"count":1,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts\/1014\/revisions"}],"predecessor-version":[{"id":1036,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts\/1014\/revisions\/1036"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/media\/46"}],"wp:attachment":[{"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/media?parent=1014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/categories?post=1014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/tags?post=1014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}