Category Archives: performance

Why You Should Set Automatic Cost Adjustment to Never in Dynamics 365 Business Central

Overview

This was one of the topics that came up frequently while working with users at the last NAV/BC User Group Summit at Phoenix.

Many people have different opinion to setup their inventory so costing is done properly. Naturally, knowing a few things on how Dynamics 365 Business Central (aka Dynamics NAV) inventory and how inventory costing works, I participated as much of these inventory costing discussions as I could.

One of the features that I always get in an intense discussion on is how the Automatic Cost Adjustment on the Inventory Setup should be done.

Arguments for Setting Automatic Cost Adjustment to Always

I do understand the desire to want to set this property to Always. And why not? Instead of running the Adjust Cost – Item Entries manually, why not let the system run the process every time? And I do mean Every. Single. Time.

Setting the Automatic Cost Adjustment to Always allows for you to have updated and accurate cost at all times. This sounds great!

Arguments Against setting the Automatic Cost Adjustment

It’s great if we can just talk about all the benefits and call it a day. But that’s now we work. Setting this property will come at a cost.

  • Performance – During posting, your users will experience delays. How significant this is will depend on how large your database is.
  • Locking issues – Dynamics Business Central will lock the ledger entry tables during posting of orders. In addition, it will lock tables when it runs the adjust cost process. Because of the stress on the performance above, the users will experience more locking problems throughout the day as people are posting. If you’re experiencing this now, try setting the Automatic Cost Adjustment to Never.
  • Allow Posting From Error – There are some instances where the adjust cost will want to post adjustments into prior periods. Depending on what you setup for your Allow Posting From on the General Ledger Setup and/or on the User Setup, you’ll run into these errors.

If you’re running a micro business with few inventory transactions, setting it to Always will make sense.

However, for a manufacturer or a high transactional volume distributor, you will cause more harm to your environment than not.

This is exponentiated if you’re using reservation or serial/lot tracking.

The Alternative

Instead of running the Adjust Cost – Item Entries process during every single transaction posting. Why not have the process run during off hours?

One of the first things we do for our client after explaining the importance of Adjust Cost – Item Entries is to setup the adjust cost process as job queue to be ran at night when the load on the system is light.

This will prevent locking up users as well as give the system a faster response when they’re doing their daily task. Who doesn’t want a system that’s responsive and allow you to do as much as possible within a shorter amount of time?

Conclusion

In every instance, I will set the Adjust Cost process to be ran automatically on the job queue. I want to give the user the best possible experience working with the system. Every delay causes frustration and we can all use less frustration in our lives.

Addressing Performance Problem in Dynamics NAV and Dynamics 365 Business Central

Overview

If you’ve recently upgraded to Dynamics NAV 2017 or later versions, you will have undoubtedly noticed that the new version of Dynamics NAV (or Dynamics 365 Business Central) is incredibly slow… It’s so slow that it took one of our customers that’s using NAV 2017 3 minutes and 38 seconds to open a customer card.

Yes, the customer really measured this. And yes, before they upgraded, opening the customer card is instant.

Note that this blog will include Dynamics 365 Business Central as I didn’t see them improving the standard codebase in the release.

EDIT: Microsoft has released a fix in their monthly Cumulative updates to address the performance problem. Ask your NAV partner to implement these hotfixes for you if you’re still encountering issues with poor performance.

Eye Candy

The problem is all the eye candy that Microsoft tries to implement into Dynamics 365 Business Central that caters to the small/micro businesses, or at least make the demo of the product irresistible.

For some odd and strange reason, Microsoft strongly believes the same customers that currently using Dynamics NAV are the same ones that are going to be using Dynamics 365 Business Central.

I’m not sure how we can tell Microsoft that this is not the case. They firmly believe they know the customer better than the channel.

An Example

Let’s take a look customer card in our example and let’s see why it’s so slow. Note that this is one of many screens in the software that has performance problems. I’m just highlighting this page for the purpose of this article.

In order for Microsoft to make Dynamics 365 Business Central look appealing in demo environments and to encourage companies to sign up on first sight, they really have to include all the bells and whistles. And I do mean all the bells and whistles including, but not limited to:

  • Charts and Graphs to display data visually. Why? Because it’s pretty.
  • Factboxes that quickly brings information to you
  • Quick statistics to give you an overview of the data without having to have that extra click
  • Dynamic control on pages – Hiding fields and really dumbing down the user interface
  • Dynamics CRM and Office connection and integration

Let’s take a look a the customer page in the demo environment in Dynamics 365 Business Central:

Looks great right? You have a really quick statistics of how the customer info. And when you navigate around in the demo environment, it’s fast.

Single Codebase

This is the screen if you use the Dynamics NAV (Dynamics 365 Business Central) on any rendition other than from the signup in the Office 365 Admin Console.

If you looked closely, you’ll notice that the Statistics FastTab is missing.

Apparently, in order to keep Dynamics NAV and Dynamics 365 Business Central on the same codebase, Microsoft just hid whatever is not applicable.

Why It’s Slow

There’s a problem with that… When you just hide the control, it doesn’t really prevent the code from running.

If you look at the customer card in the Development Environment, you will see the Statistics FastTab has the Visibility function set to FoundationOnly.

The toggle for setting this is nowhere to be found if you’re not using Dynamics 365 Business Central accessed from Office 365 Admin console.

The problem is the code is written in the worst way possible with no regards for optimization.

It’s doing calculation on massive amounts of data with every time you click on something on the customer card. Good for small datasets (<1000 records), problem if you actually use the software to manage your business.

This means any time a user does something on the page, it’ll run this calculation, over and over and over and over again. Think about your customers that has a 50 GB database, worst, you’ll notice a slowdown with customers running a 1GB database.

The Fix

One would think the simple fix is to just remove the controls from the page. Wrong… The cause of the slowdown is not on the display itself (although the Dynamic Control does slows down performance), it’s the code that’s running in the background.

The code you need to take out is in the triggers of the page.

And here

Removing code on the OnAfterGetRecord and OnAfterGetCurrRecord triggers dramatically improves the performance of the customer card.

Note there are a lot of other things we have to remove from the customer card to make the performance acceptable for the end user. But I will stop here for now.

The Extension Problem

So how do you do this when we’re going into the Extension world? Extensions will NOT allow you to remove base code, so you’re stuck with whatever crap Microsoft stuffs in there. Tested or not.

Looking at the amount of code in the customer page, I’m actually shocked on how all of this got past Quality Control at Microsoft.

Whoever thought it was a good idea to do a lot of rendering and processing at the page level?

You’re asking for performance problems when you’re rendering a large amount of data. This was one of the first thing they taught us at the Navision development class back in 1999; don’t put code on forms/pages.

Conclusion

This article is just focusing on a single page, the customer card. If you look at Sales Order page, another one of the pages that a lot of companies access frequently, it has the same types of problems: too much code on the pages.

Again, a lot of what they stuff in there is nice for demo environment with small datasets. You’ll notice performance problems real quick as your data set increases.

Perhaps this is an opportunity for developers like us to publish an Extension on AppSource. Basically redo NAV pages so people can actually use it.