Let’s talk about error handling. Specifically, why your code shouldn’t blow up when something goes wrong.In Business Central development, a runtime error doesn’t just stop your code it rolls back the entire transaction. TryFunctions allow you to “try” a risky operation and catch the error before it crashes the user’s session. ✖️ The ProblemErrors that…
Read articleLatest articles
Microsoft Dynamics 365 Business Central
The feature that separates flexible code from maintenance nightmares. ✖️ The ProblemStop hard-coding your Business Central dependencies. When you declare a specific codeunit variable instead of using an interface, you’re creating a rigid coupling that’s difficult to undo. Build for flexibility today, or you’ll be rewriting your logic in six months. 🛠️ The FixInterfaces –…
Read articleThey function as in-memory record variables, resembling regular tables while remaining independent of the database. Perfect for staging datasets, applying complex filters, and minimizing query repetition. The ProblemRepeated querying of the database and applying multiple filters to the same data poses a significant performance issue. Example report on Domestic sales, Export sales, High-value orders. The…
Read articleLet’s discuss how using Commit() incorrectly can silently destroy your data.What does Commit() really do?Commit() ends the current transaction and initiates a new one by forcing BC to save all pending database changes right away.Sounds useful. It is risky if you do not comprehend the implications. The ProblemA commit in the middle of related operations…
Read articleAs developers we often find the need to construct large text strings, whether we are building xml export, massive json or a csv file, and our immediate instinct is to use += The ProblemString concatenation in loops. It is because strings are not able to be altered in memory after its value is set initially….
Read articleLet’s talk about this simple mistake that can be misleading. The rule is that you only use VAR when you intend to modify the parameter.Using VAR when you do not need it is like leaving your car running while you shop. wasteful and dangerous. The problemIf you are not intentionally modifying the parameter avoid using…
Read articleIt gauges complexity by tallying up the operators and operands in your code, essentially estimating the mental effort required to understand a function.Operators: +, -, :=, AND, OR, Get(), Insert()Operands: variables, constants, field namesA high Halstead Volume means your brain has to work harder to make sense of the code, in other terms, it often…
Read articleYour code might be too complex and it’s slowing you down.Lets talk about cyclomatic complexity. Sounds fancy, but it’s really just how many decision points are in your functions. The problemTime lost is the cost of complexity as bugs fixes takes longer, adding features delays and new team member gets lost for days trying to…
Read articleThe ProblemYou’ve optimized your code, trimmed every loop, and tuned your queries but performance still drags. Why? Hidden event subscribers might be firing behind the scenes on every database operation, quietly stacking up execution time and slowing everything down.The Fix🔧Keep subscribers leaned and focused – The leaner the codeunit, the faster the execution. That’s why…
Read articleOver the past month, we have covered performance optimization techniques. Today, let’s see how they work together to transform daily operations.Performance stack🔹Dictionary and lists for caching🔹Dictionary for eliminating redundant database calls🔹SetLoadFields for targeted data retrieval.🔹FindSet pattern for efficient record IterationThis set of patterns is great for process improvement. Imagine running a supermarket.✅ SetLoadFields — Instead…
Read article