Author Archives: Mark Brummel

Programming Microsoft Dynamics 365 Business Central – Sixth Edition

It’s a wrap. After 9 months of work the latest edition of the programming book is finished.

This is the sixth edition but the first to be AL only. A very specific choice that I made when I started on the project. And a bit of a gamble since I was unsure how long C/Side would last when we started.

When you buy the book you will recognise the script and programming examples. This is unchanged and based on the creativity of Chris Studebaker.

Also the wisdom of half a century worth of programming is untouched. The legacy of Dave Studebaker.

However, the book is probably 100 pages thinner than the previous (and last) C/Side version. Yet it contains just as much information.

The reason is relatively simple. “We” (as a community) moved to a standardised Code Editor.

Because C/Side is very specific the book spent a lot of time explaining it’s quirks which is necessary to get a newbie up to speed. With Visual Studio Code this is no longer required and there are plenty of getting started video’s and blogs.

Another thing that changed is the rapid changes that happen in both Visual Studio Code and the AL programming language. One example is a piece of code about changing the dropdown that was removed from the book at first because it was no longer possible. A few months later this was added to AL by Microsoft.

For this reason I tried to keep the book as specific to AL as possible.

Two other major changes are the move to Word as report editor and the removal of DotNET client add-ins.

The previous edition had a special chapter around specifics for RDLC. Since this is unrelated to AL it was removed. This edition covers how to create the Report’s DataSet and how to access that from Microsoft Word.

Another element that is removed is DotNET. This was replaced by JavaScript add-ins which is a specific technology for which a lot of information is already available. The basic interface is described on Microsoft Doc’s.

The result of the rewrite is a book which is more affordable and focusses on the essence of AL development. (The price went down together with the page count).

My hope is that we get more books around specific topics like Luc van Vugt did with Automated Testing.

Since we anticipated on the retirement of C/Side the book is future proof. We do not cover how to add your own events to Microsoft’s code. If you want to cover this I recommend the Quick Start Guide from Stefano and Duilio.

My next challenges would be to see how much work is involved in upgrading the Application Design book and the Design Patterns. The latter would probably be relatively doable. The Application Design book is a lot more difficult since it is based on doing core code modifications rather than teaching a programming language.

I’ve been involved in this book from day one. First as a reviewer, then co-author. The last two editions where updated completely by me while leaving the great work of the Studebakers in tact.

Enjoy the book and let’s make AL, in all it’s awkwardness, shine for a new generation of programmers.

https://www.packtpub.com/application-development/programming-microsoft-dynamics-365-business-central-sixth-edition

I wanted to thank Microsoft for making the AL-Only preview available just when I needed it for the examples in my book. The work would have been a lot harder without that.

Also thanks to Michael Nielsen for the AL Converter which was used to convert most of the example code in the book which can be found on GitHub. If you find any errors please do a pull request. https://github.com/markbrummel/Programming-Microsoft-Dynamics-365-Business-Central

Programming Microsoft Dynamics 365 Business Central - Sixth Edition Book Cover
Advertisements

C/AL to AL, but better & faster

At the airport of Copenhagen (CPH) eating my favorite burger. (Aamanns Burger). Then writing a blog.

This is an awkward blog, a blog that was asked for by my colleague Jan when I spent a few days at our office. He asked if I could blog something about converting from C/AL to AL with the ForNAV converter based on the series of blogs by Freddy. (https://freddysblog.com/tag/c-al-to-al/).

Off course, at ForNAV, converting code is our bread and butter. But our converter from C/AL to AL is free of charge. Everyone can use it and when they find an issue enter a support ticket. Why should we promote that? It’s just more work…

But here we go!

Skipped Step 1 – Upgrade to the latest C/Side

This is an obsolete step when using the ForNAV converter to convert to AL. This saves you a lot of time because you can create an extension directly from any 2013 or newer database.

The reason Microsoft needs to you first merge in C/Side is that they did the preparation for the conversion in FinSQL.exe. The ForNAV converter does that natively in the process.

Skipped Step 2 – Change Codeunit 1 event subscribers

I blogged about this yesterday. Microsoft has removed codeunit 1 and you have to change all your event subscribers.

The ForNAV converter takes care of that for you. We convert all your subscribers. (This is off-course useless if you are on 2013…)

Skipped Step 3 – Usage Category

Menu Suites are dead, and that is not a bad thing. They are replaced by a new property called Usage Category.

The ForNAV converter populates the Usage Category for you based on the menu suite. A lot less manual work

100% Automated Conversion

It is possible to have 100% automated conversion and keep one codebase. Thousands of customers will keep running C/Side for years and as an ISV you want to serve them.

My recommendation to ISV’s is to achieve 100% automated conversion so you can keep downgrading and upgrading.

You can download the free ForNAV converter to AL here. https://www.fornav.com/download/

The benefit you get for free is that you get to use C/Side for many more years and you can probably get to Visual Studio Code once it is stable and equally productive as C/Side.

YouTube Video…

This video shows what you can do with the ForNAV conversion tool. It’s free to use and will save you a lot of time compared to the Microsoft tooling.

Eternal Refactoring | Are you ready?

Microsoft Dynamics 365 Business Central is the best and most customizable ERP that ever existed.

There, you have it.

For some people it’s hard to understand that in one blog I am trying to protect our ecosystem from loosing C/Side and in the next I am praising Business Central to be miles better than any other cloud ERP.

The reason is honesty and reflection.

If you don’t know NAV/Navision then Business Central is an ERP from Venus. The Web Client’s interface is next to nothing you have seen and no other cloud ERP has so many events and extensibility possibilities.

But if you are a Navision partner you are looking at your product and you see Microsoft killing it in favor of the cloud.

I said more than once that I wished that Microsoft had picked GP to be the cloud baby and put NAV in maintenance mode. That way we would have two choices. Keep running our current business OR move to the cloud.

Now Microsoft is killing C/Side and giving us no other option than to move. I am not saying move forward. In some ways, many ways, it is a step backwards.

Business Central is essentially a fancy shell over and old product. Two parts of our product are old. The code base and the language. And I think this will haunt us.

If you start programming for Business Central it looks nice and cool, but you don’t need more than 15 minutes to find out that AL is not in any way like other programming languages.

As Navision developers we know why and yet we don’t. AL is not object oriented. It does not know classes and inheritance. No polymorphism. Our base app is full of code cloning and everything that goes against clean coding principles.

Good people with great intentions at Microsoft want to change that. Which is great! They intend to refactor our base app in favor of a decoupled architecture.

Nobody could be more happy than I am.

Yet Microsoft made a promise. With extensions our lives would be easier. They made a promise that an upgrade would not be replacing an engine anymore. They promised an oil change.

The prerequisite to the oil change is extensions.

OK.

Let’s imagine I am a customer, and with NAV 2018 I had choosen for extensions. Now my live is easy right?

Is it?

What did Microsoft change in NAV 2019? (Sorry, Business Central). They removed codeunit 1. Eh… Ok. Wasn’t that a codeunit with like a million event publishers that everyone was using?

Hmmmm. So If I am subscribing to that I have to change all my events?

YES!

Bye, bye promises.

So what is next? What is the next part they will change? (If you can call one codeunit a “part”).

Roumours say the TempBlob table will be an extension on it’s own wrapped in an API.

Hands up who uses the TempBlob table? (people raising hands).

Hands up who has to refactor their code? (people raising hands)

So Microsoft refactored two large portions of the base application (2 out of 7000 objects).

What can we expect if they REALLY separate Manufacturing from the base?

What can we expect if they REALLY separate Jobs from the base?

Let’s take it one step further… the retirement from C/Side

… (three dot’s anticipating you as reader to get impatient)

If you have an ISV solution and you want to move to AL, you have to first migrate to the last C/Side version…. Then you have to move to extensions OR do customizations in AL.

After Microsoft moves to AL they will start refactoring the base app. So this means your AL solution get’s separated from your C/Side solution. And all of your existing customers, the customers that pay the salary of your employees, the rent of your building, the retirement funds and your sports car (which they don’t know about), are on C/Side.

Hmmmmm…

Refactoring forever… are you ready? How is Microsoft going to communicate what they change?

Questions…

Why C/Side will last another decade… at least…

The move by Microsoft from C/Side to Visual Studio Code is a bit like Brexit. At first everybody thinks it is a great idea, until they realise the consequences. And then there is no way back.

Why? Please let me explain…

With C/Side we have issues, everybody knows that and these issues have to be solved. Issues like integration with source code management and other issues like… well… hmmmm.

Visual Studio Code is the new kid on the block and it’s cool, it’s the most popular source code editor of this moment. However when you combine it with AL code it’s not always an improvement.

Microsoft claims partners have been demanding a more modern coding experience but let’s compare it to PowerBI. Does PowerBI have source code management? PowerBI has a native designer just like C/Side and PowerBI is very popular.

The reason C/Side is going away has nothing to do with partners demanding anything. It has become very hard to maintain C/Side and it’s preventing Microsoft from moving to the cloud.

It’s impossible to compete with the Microsoft Marketing machine. No matter how much feedback the product team is getting they make their own decisions.

I spend my time 50% in C/Side and 50% in Visual Studio Code. I know all the VSCode shortcuts, snippets etc. but going back to C/Side just makes me happy every time I switch.

Programming anything in Business Central involves mostly defining Meta Data. As programmers we write surprisingly little code. Visual Studio Code is horrible at defining Meta Data. Most other programming languages use templates for this.

Have you actually tried to create a report in Visual Studio Code? OMG… please don’t.

It seems like the Business Central teams are not yet at a point where we can easily juggle with Meta Data. We cannot yet create a listpage & cardpage for a table which would be an easy example of this.

Extensions

In our community Visual Studio Code is synonym for Extensions. This is just wrong.

With relatively little effort Microsoft could have made Extensions work in C/Side. It would have meant adding Table Extensions and Page Extensions as object type. Not much more than that.

Many partners, actually the vast majority, have issues moving to Extensions. Not because the concept is wrong, but because the base code is not designed to be extended. The Business Central code base is from the late 1980’s and is not object oriented in any way. Not even close.

The solution that Microsoft is now proposing is that we can make raw source code modifications in Visual Studio Code.

This is horrible!

Visual Studio Code is not optimised for this. Not even closely. C/Side is.

It looks like we are getting into a worst of all options kind of scenario where nobody wins.

At NAVTechDays Microsoft announced that they would rewrite the Business Central code and break it up into extensions. I have not seen any progress on this, not any session at Directions ASIA, no blogs, nothing. Complete silence.

Get comfortable on the Spring release

It looks like the Spring release of Business Central will be the golden release to get comfortable on. Just like NAV 2009R2 was.

We can use the best of both worlds. C/Side for the majority of the work and Visual Studio Code where possible and where it adds value like using JavaScript Add-In’s or making UI changes to the core UI.

As a community we need to make Microsoft understand that this release must be maintained for at least five years, or possibly ten until Business Central is completely rewritten and object oriented.

Until then, for most partners it’s simply not worth the effort. They will burn money and resources getting only disappointing results.

Xliff Compare & Finding Missing Translations

When working with Extensions I would not recommend working with Xliff files unless you design for AppSource. Otherwise CaptionML will work fine for Per-Tenant projects.

Unfortunately for me, I am working right now on submitting an AppSource project and I need to evaluate if my translations are complete.

As I explained at my presentation in Antwerp at NAVTechDays we continue to code in C/Side and then convert to Extensions and submit to AppSource. Therefor I don’t have the nightmare problem of maintaining Xliff files, I do however need to figure out how complete I am.

So in C/Side I am using CaptionML and when I convert to Extensions I simply use this flag in our converter which I have and you don’t. (Nananana…)

ForNAV Converter

We’ll change that soon. But meanwhile let’s look at the output.

Translation

You don’t need to be a rocket scientist to see that for example Czech and Swedish probably have missing captions. But which ones?

Michael has created a simple C# console application that will generate a file you can open in Excel to analyse this.

Result

You can download the tool from our GitHub. Don’t hesitate to make improvements.

https://github.com/ReportsForNAV/xliffCompare

Stay tuned for more info and learnings with Extensions, AppSource and converting code…

Compiling a 2000+ Objects Extension

Let’s start diving into working with Extensions in Real Life. I have a lot to blog about and at first I thought I would blog about a very small extension but I’m sure you’ve all seen that.

Let’s start big!

At NAVTechDays I showed you the extension I created with the ForNAV converter that resulted in 2149 files which compiles and executes.

I made the extension work on Business Central OnPrem, installed on my local box with the RTM version.

What is the Build Time? It must be horrible…

You are probably most curious about the build time for this extension. It takes 30 seconds on the RTM version. Not bad, but not perfect either.

Now Microsoft promised that they would improve this experience because they also need it themselves. They asked me to text CU1 and the Daily Docker builds to see if that improves performance.

Runtime 2.1

Today I’ve installed version 2.1.69331 of the compiler and the build time went down to an average of 18 seconds. That is a great improvement! Well done team!

Break it down!

I’m going to keep this version of my extension to test the next versions to see if more improvements come our way.

However, I am also going to break down the monolith and see if I can get to smaller components.

This will also improve the maintainability and makes responsibilities more clear when working with multiple developers.

What’s the perfect size?

If you had asked me that three months ago I would have said 100-200 objects max. But now I think 500 objects should work fine from a compiler perspective.

Remember that when you break your ISV solution down you’ll most likely end up with more objects as you will create table and page extensions on your own objects. It will also be harder to assign object id’s.

To be continued…

 

 

Blogging & “The Gap”

A little over a week ago I attended the Dutch Dynamics Community again, for the first time in a while. It was good to catch up and exchange news with peers in my network.

“You’ve been quiet Mark!” is what I’ve been told a few times and that’s true. For some time I try to be quiet and focus on things that are more personal like being a dad of five now and trying to manage the project of fixing up my Land Rover Defender.

It’s not a secret that for quite a while I was in big disagreement with the roadmap Microsoft was following and my resignation as Microsoft MVP was a direct result of that.

“You have enemies? Good. That means you’ve stood up for something, sometime in your life.” ― Winston Churchill

Last week I’ve joined over 1.400 of my fellow Navision enthousiasts into NAVTechDays. In the eight years of the event I’ve done eight presentations. Each year I say it’s the last time and each year someone manages to convince me to do it again. This year Peik asked me to be his wingman and share real life experiences about working with Extensions.

The main session room was full. Only a few empty seats here and there and when I walked out of the room I asked Gunnar if he knew how many were in the overflow room. Many attendees later told me that the overflow room was a standing room. If I remember correctly 700 can fit in the large room and 400 in the overflow room. You can do the math.

The vast majority of the attendees wanted to see real life experiences working with and upgrading to extensions.

This came as a big surprise to me even though my colleague Michael Nielsen keeps telling me almost nobody is using extensions yet except to play with on AppSource with small experiments.

Why is that? Why is our community so conservative?

I’ve asked this to many of the attendees and the most popular opinion seems to be that Microsoft is moving to fast with first Extensions 1.0 and soon after that version 2.0. Many seem to wait and see if there will be a version 3 before it’s time to start.

Well, I have news for you. There will not be a version 3. Extensions as we know today is what we will have to get used to and soon, because Microsoft is determined to discontinue C/Side soon. Very soon.

Or Wait, Will there be “Extensions Version 3.0”?

CSide

It’s easy to look back and see how things could have been done differently.

There was huge pressure on the Dynamics SMB teams to release Project Madeira and compete in North America with QuickBooks. Project Madeira failed and The NAV community paid the price for that bet big time being almost killed completely last year right before the start of Directions North America.

Without that pressure the team might have had more time to add Table Extensions and Page Extensions to C/Side as I suggested at the end of my session last week.

Extensions Version 1 with it’s clumsy way of packaging using PowerShell broke the reputation of extensions before it even had a small chance of success in a community that still remembers the pain of the introduction of SQL Server and the Three Tier concept.

Hit Reset and Start slow

Microsoft seems to now have a better understanding of the complexity of it’s own application. The biggest news for me at NAVTechDays was that finally Microsoft announced the refactoring of the core application. Thanks Bugsy!

2295c298-fe20-4a80-9321-b0bd1ce9d1e5-original.jpg

This decision is crucial for the long term survival of our product in a modern, object oriented world where everything is connected in the cloud now that internet is becoming as reliable as the power grid.

To be able to break the application into Micro Services Microsoft has to introduce new concepts and for this they need Visual Studio Code. It’s something that they cannot do in C/Side, or at too high a cost. Just like adding Table Extensions and Page Extensions would have been too expensive.

Step one will be to move all objects to a Monolith “Extension” where we have to find a new word for “Extension” since it will essentially be the new “Core” we as programmers will start building upon.

Step two is to introduce a new programming concept that will allow Microsoft to decouple into smaller modules with an extendible contract. This concept allows to both extend and replace these modules.

Observe and Learn

In the last two years I’ve seen Microsoft ISV’s burn money and resources trying to make extensions work with the current C/Side monolith and it seems like the majority has been a learning experience most cannot afford.

My advise to the vast majority of my peers would be to give Microsoft time to create this new modular ERP application and use that time to wrap your head around Visual Studio Code.

Extensions are here to stay and Visual Studio Code is our development environment.

Prepare to be broken

One of the biggest fights I did with Microsoft was the ridiculous promise that they would not break extensions and that extensions would be easy to upgrade.

Now with Business Central we all know different. Removing Codeunit1 broke 99.5% of all extensions and Microsoft continues to break extensions and send partners messages about having to change their solutions.

Break

How can I help?

What I will do in the next few months is start publishing the extensions I’ve created in the past year that can be reused in our ecosystem like the phone book app I showed at NAVTechDays or the app that uses the API to synchronize between Business Central databases.

I encourage everyone to do the same. Start sharing code and start blogging. We desperately need blogs with real content rather than announcing a cumulative update or promote something that Microsoft has asked to promote.

In the next few months I will also start to replace some of my DotNET code into Azure functions which is something I’ve been told is holding a lot of ISV’s back.

How do you start?

Soon there will be an easier way to convert your C/Side solutions to extensions as was announced at NAVTechDays. As soon as this is available I will publish it on my blog. The more feedback we get from the community the more we can improve this tool.

Some of you have said to Luc at NAVTechDays that I was a bit over enthusiastic during my session about the origin of this tool so listen very carefully as I will say this only once.

The tool is made my Michael Nielsen, the father of C/AL, and shipped free of charge by ForNAV.

To be continued… Soon…

See you in 2019 at BCTechDays…