{"id":1005,"date":"2026-11-06T08:30:00","date_gmt":"2026-11-06T13:30:00","guid":{"rendered":"https:\/\/www.dataflowsoln.com\/blog\/?p=1005"},"modified":"2026-11-06T08:30:00","modified_gmt":"2026-11-06T13:30:00","slug":"long-batch-jobs-freeze-your-users","status":"publish","type":"post","link":"https:\/\/dataflowsoln.com\/blog\/long-batch-jobs-freeze-your-users\/","title":{"rendered":"BC Teardown #5: Long batch jobs freeze your users"},"content":{"rendered":"\n<h2>The pain<\/h2>\n<p>Someone starts a price update or recalculation and their Business Central session is locked until it finishes.<\/p>\n<h2>Why it happens<\/h2>\n<p>The job runs in the user&#8217;s own session, in the foreground, so they cannot do anything else while it runs.<\/p>\n<h2>Before: Run it in the user&#x27;s session<\/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>trigger OnAction()\nbegin\n  Codeunit.Run(Codeunit::\"DF Recalc Prices\");\n  \/\/ the user waits until it is done\nend;<\/code><\/pre>\n<h2>After: Hand it to a background session<\/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>trigger OnAction()\nbegin\n  TaskScheduler.CreateTask(\n    Codeunit::\"DF Recalc Prices\",\n    0, true, CompanyName(),\n    CurrentDateTime() + 1000);\n  Message('Running in the background.');\nend;\n\n\/\/ Recurring? Schedule it as a\n\/\/ Job Queue Entry instead.<\/code><\/pre>\n<h2>The result<\/h2>\n<p>The work runs in the background. Users keep working, and recurring jobs run overnight with no one watching.<\/p>\n<p><strong>Tip:<\/strong> Add a failure codeunit so errors get logged instead of lost.<\/p>\n<p><a href=\"https:\/\/dataflowsoln.com\/blog\/wp-content\/uploads\/2026\/11\/BC-Teardown-5-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>Someone starts a price update or recalculation and their Business Central session is locked until it finishes.<\/p>\n","protected":false},"author":2,"featured_media":19,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[3,9,14],"class_list":["post-1005","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bc-teardowns","tag-al","tag-business-central","tag-job-queue"],"_links":{"self":[{"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts\/1005","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=1005"}],"version-history":[{"count":1,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts\/1005\/revisions"}],"predecessor-version":[{"id":1027,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts\/1005\/revisions\/1027"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/media\/19"}],"wp:attachment":[{"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/media?parent=1005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/categories?post=1005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/tags?post=1005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}