Meta UI Control Add-Ins for Business Central, how and why…

Today we’ve successfully completed a workshop at Vos Transport with Global Mediator where we did a demo/prototype of a new user interface defined on metadata embedded in Microsoft Dynamics NAV using client add-ins.

We’ve been working on preparing this workshop for over 12 months and I am very happy and proud of the result.

Client Add-Ins

Within Microsoft Dynamics NAV, client add-ins have been possible for a long time, yet not a lot of partners have picked up the technology except for edge cases such as Point of Sale and Rich Text Editors.

The problem we are trying to solve for Vos Transport is giving insight in the data to the users of the planning system. This is a customized part of their NAV system but you could compare it to Manufaturing or Service order scheduling challenges.

For many years we’ve struggled with the limitations of the NAV user interface such as lack of drag and drop, resizable rowheigts, conditional coloring, concattenating columns and double/right mouseclick events.

On top of that we wanted visual insights in the planning using either time lines and/or visual components in maps with modern options like heatmaps.

I’ve seen other partners build external components for this, mostly using Web Services but I’ve never felt comfortable with these since they make navigating back and forth to NAV very hard.

Flexible & Low-Code

Even though I am proud of our internal IT department at Vos, we cannot take the responsibilty of creating our own UI for something like this, and even if we could, we lack the in-house skills for such a level of front end development.

This is why we started to talk with Global Mediator to build a brand new Page Designer that allows a new level of UI flexibilty in NAV/Business Central.

The goal is that any NAV Admin person can configure these pages without any knowledge of complex frameworks. Just a little knowledge about the NAV datamodel, basic HTML and JavaScript will sufice. The later only for conditional formatting to create simple boolean expressions.

The Result

In essence the Meta UI tool allows you to convert any list page in NAV to a new format where any formatting rule can be applied, rows can be concattenated, pyjama printing can be applied and if you want, one column can be rendered as a representation of a time line.

The tool allows expandable subpages where multiple rows can be expanded at the same time allowing us to drag and drop for example a sales line from one sales order to another sales order.

Microsoft Graph API & JavaScript Add-Ins

The technology used behind the scenes are the new Microsoft Graph API and JavaScript Add-Ins. Both introduced in NAV2018 making that the “oldest” version to support the Meta UI.

If you want to build a Meta UI page on a cusomised table you need to generate the API definition which will automatically be added to the endpoint by the NAV framework.

Next Steps

The Meta UI will be taken into production this weekend and roled out for a few pilot users to give feedback, especially about the performance.

In September we will evaluate the experience and define if the tool will be implemented accross the whole company in all our offices across Europe.

Roadmap

We’ve already started the scope for the next project using the Meta UI tool which will include an HTML editor and a PDF viewer which is going to help us convert orders we receive in PDF format more automatically.

Are you interested?

Now that we’ve proven the technology and moved the first customer into production we want to talk to other NAV/Business Central partners who have the same need for a more advanced grid component, map controls, PDF viewers or HTML editors. Maybe you will challenge us to add more components to the toolbox.

It requires a minimal learning curve to get started and shows great results very quickly.

I will share some screen shots very soon as we will do some clean up first based on the workshops feedback.

Extending Role Centers

There should be a simple rule that applies to all members of our community. If you struggle with something and find out the answer, then share it. If everyone starts doing that I’m sure it will improve our community and bring back some joy in the world were even most MVP’s just blog so sell their marketing messages.

Again, today I wasted much valuable time of my life chasing weird behaviour in our ForNAV AppSource solution.

As most partners we struggle to find a good balance in simplicity and I had this great idea (or at least I thought it was a great idea) to personalise the role center.

I’ve added a menu item for our AppSource solution that contains the shortcuts that most people need and I wanted to hide those unimportant.

When working with page extensions I always try to work with AddLast to have the smallest change of breaking during upgrades.

You can see that the visibility of one of the items is toggled. Here is my code

Simple right? Only show the Replace Reports to an admin or anyone who can manage their own data.

But then the trouble came. This compiles, builds and publishes just fine but the visibility is not toggled.

Then I remembered something from C/Side. IT IS NOT ALLOWED TO CODE IN ROLE CENTERS!!! And I am extending a Role Center.

So I guess you can call this a bug. When extending a rolecenter it should not be possible to write code.

For me this is back to the drawing board and I will try to come up with a better solution.

Extensions | An item with the same key has already been added

If you work with Extensions in Dynamics NAV there is a fair chance that you’ve seen this message.

Today I got it again, waisted half an hour of my live and decided to blog about it.

What happened is that I have a Page Extension with the same variable name as already exists in my C/Side page.

I’m working with NAV2018 CU17 and the compiler did not complain about this and the publishing process went fine. When you try to open the page the client crashes and this error is what you get in the Windows Event log.

Hope this helps someone.

‘Codeunit’ does not contain a definition for… (AL0132)

Today I got this error message while publishing an extension to our Development system. Since our Development system just moved to Azure last week our Azure Specialist and I spent some time troubleshooting this.

As always with these things the root cause was not in Azure SQL, but in my C/AL code in C/Side.

Our database is hybrid and what I did is removing a codeunit. This was a cleanup since we moved one of our custom DLL’s into an Azure Function.

The root cause of the AL0132 was a global variable pointing to a non existing codeunit.

‘Codeunit’ does not contain a definition for ‘xServer Management’

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

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…