Dynamics Business Central / NAV Development Developer Digest - Vol. 400

Dynamics Business Central / NAV Development Developer Digest - Vol. 400

ArcherPoint’s Developer Digest focuses on Microsoft Dynamics 365 Business Central and Dynamics NAV development. In Developer Digest Volume 400, you’ll read about code cop violations for Business Central base code. Let the drama begin!

The Dynamics NAV and Business Central community, including the ArcherPoint technical staff, is made up of developers, project managers, and consultants who are constantly communicating, with the common goal of  sharing helpful information with one another to help customers be more successful.

As they run into issues and questions, find the answers, and make new discoveries, they post them on blogs, forums, social media…fot everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this community—so we thought, wouldn’t it be great to share the wealth of information with everyone who might not have the time to check out the multitude of resources out there?

Thus, the ArcherPoint Microsoft Dynamics NAV/BC Developer Digest was born. Each week, we present a collection of thoughts and findings from NAV/BC experts and devotees around the world. We hope these insights will benefit you, too.

Code Cop Violations for Business Central Base Code

Kyle asks the team: “Has there been any discussion around the blogo-twitter-spheres about Microsoft turning on code cops for their own code? It was fun the first few times, but now it has gotten old – I copy a base app object to a new custom object and introduce 1,006 code cop violations that cause partial build failures. And this was from BC 20.3.”

Matt T: “I don’t think it will ever happen. I’d imagine they do it as they refactor into all of those smaller apps, but don’t know.

What base code are you having to copy that you can’t extend?”

Kyle retorts: “Hooray! Another Matt / Kyle Slap-Fight!

First Use Case: New custom field on Customer – Type: Distributor, OEM


A Salesperson can see all Orders that have the BillTo = Distributor

A Salesperson can only see Orders if the BillTo = OEM and they are the SP Code set on that BillTo

The only solution I could find was to copy Sales Order List, set it to SourceTableTemporary = true and then load the orders that fit those rules during OnOpenPage.

Anything I’ve had to copy has been a page, and only because they do not expose those top-level page properties in a page extension.

Second use case: 1099 code. Whoever does the U.S. localization (a) sucks at writing code and (b) never gets it done until the last minute. So, for three years running, I’ve had to copy all of the 1099 objects into new Custom objects to get the data and report formatting correct by the January 31 deadline.

Tom H adds: “I’ll chip in with one use case that comes up all the time: The customer wants to create a custom document report that’s a copy of an existing report. So we copy the existing sales order/invoice/credit memo or purchase order/invoice/credit memo (or whatever it is) into a new report from the base code and start our customizations, and code cop immediately tells us that we’ve got to clean stuff up.

Even stuff like the order of variable declarations is wrong! It’s crazy.

I’m not optimistic that they’ll bring their code up to snuff anytime soon, but I’d like to see it anyway.

Matt T responds: “The first two I kind of get, especially the 1099. With reports, 1 of 2 things is likely true:

  1. The new report development features like report extensions and embedding multiple layouts hasn’t been looked at
  2. I am assuming too much can easily be done with those report development features because I am fortunate enough to not have to had develop a report in a while.

Would not be shocked at all if it was the latter.

Interested in Dynamics NAV and/or Business Central development? Be sure to see our collection of NAV/BC Development Blogs.

Read “How To” blogs from ArcherPoint for practical advice on using Microsoft Dynamics NAV and Dynamics 365 Business Central.

Trending Posts

Stay Informed

Choose Your Preferences
First Name
Last Name
Subscription Options
Your Privacy is Guaranteed