Monthly Archives: January 2020

Working on Design Patterns for Business Central

Yesterday at Microsoft I had two meetings, or goals. The first as you know was about our initiative to do a proof of concept to break the BaseApp into smaller extensions.

The second meeting was about revamping the old Design Patterns we had for Dynamics NAV and bringing them up to speed for Business Central.

For those of you who don’t know or to refresh memories; a few years ago there was a joint project between Microsoft and the community to document Design Patterns.

The old patterns wiki still exists but there have not been any updates.

A Modern World

Things have changed a lot in the last few years and Microsoft moved from MSDN to Docs who are open source and maintained on GitHub in markup language.

Within Microsoft there is a standardised way of documenting best practices with code examples, also maintained on GitHub that must me working examples people can clone and compile.

Five years ago all of this did not exist and even if it would, C/Side would not integrate anyway.

Thinks have changed for sure.

Perfectly Mixed Priorities

When talking to Business Central leadership there is a need to publish modern patterns about extensibility. This is is awesome but my personal ambition has always been to keep the old patterns alive.

We agreed that this would be a perfect mix since MSFT can take the lead on the modern stuff and the community will update the old patterns if they still make sense.

Examples

Step one will be to publish half a handfull of examples to inspire people. I will take on this task and work with Microsoft on finetuning the process

Call on the Community

The first patterns project was driven by transparency and community. I hope to be able to call again on you folks, my readers. If we get 5 to 10 volunteers to update some of the old patterns to Markup Language and AL/GitHub we should have them up to date in notime.

So please maintain some patience while we execute on some of the first steps, the plumbing. This always take longer than you expect but it will be there eventually.

Thanks, and goodbye from CPH airport.

Enum != SchemaChange

I love a nerdy title and I love learning about cool new smart stuff.

But before you continue reading I want to say thanks to my colleagues at ForNAV, especially Michael Nielsen. Without him pushing me (again) to step out of my comfort zone this would not have been possible.

Yesterday I visited the Microsoft office in Lyngby for the first time in a very, very long time to talk about our project to split up the base app. We also talked about something else, but that will be another blog. (Soon…).

The biggest showstopper we had in the old days with C/Side to separate code was the option field. Option fields are often where modules get together and programmers make switches in the code about which business logic to execute.

This is fixed now with the enum, and it will be even better in the next spring release with the interface implementations.

But before you can execute on that you have to change the Option field into an Enum. And yes, this means changing a field type.

Changing field types is not allowed in AL when you run on AppSource. You have to obsolete the field and introduce a new field.

You can imagine that this makes implementing this feature incredibly complex right?

The day before yesterday’s meeting however I sat down with Michael at our office in Horsholm to see if we needed to make changes to the ForNAV product in order to implement Enum support.

Imagine how surprised we were when we noticed that the FieldType::Enum did not exist.

And we did some testing and it looked as if an Enum field returns FieldType::Option.

I tweeted to #BCAlHelp and got no logical answer.

So I decided to save this question for my meeting with Microsoft, also because one of our team members, Cristina Nicolàs identified the schema change as a project risk.

At Microsoft I was happy to learn that this is all by design. Someone smart at Microsoft must have realised that since at SQL Server level this is always an Integer anyway it would only make sense to allow this flipping without making a breaking change.

The Test!

Off course I had to test this in order to blog about it.

I have created a simple table with an option field and published this to a Sandbox.

Next I change it to this

And yes, I can publish this without getting errors.

Enums will come in next Spring Release!

All of the teams in our project of splitting up the base app implemented their own Enum’s because last Fall release was shipped without it.

We were happily surprised to hear that Microsoft has implemented the Enum in the usual suspected places and they are expected in the next Spring release.

I’ve been told, but I did not yet have time to confirm this, that the Insider Docker build already as this code. The compiler of this Docker image also allows you to play around with Interface objects.

Enjoy!

Again, thanks to everyone to make this possible and transparent. Thanks to the Base App split team and thanks to Jesper and Bugsy at Microsoft,