Business Central Development Techie stuff

Developing with MS Business Central

Sometimes like to share what I’m doing work-wise, which are usually handy or helpful snippets (often around WordPress and Woocommerce), or moaning about a Java issue or badly documented framework.

As part of a big project we are moving from an Java based ERP system called Sterling (IBM), to Microsoft Business Central, which used to be called Navision back in the day.

To do anything other than the “out of the box with config” we can right extensions – which are developed using its own development language called AL (Application language?). I’m told it’s Pascal-based, and it’s certainly NOT Object Orientated, so it’s quite a change from the Java code I’ve been writing and supporting for MANY years. It’s very much back to ‘cut-n-paste’ for re-usability (that’s probably being unfair, but it feels that way). Gone are words like polymorphism – which is probably a good thing!

Where it is powerful is if you need an ERP system with a strong fully featured finance system that you can build upon, then it’s got you covered. It also provides a simple system to create ‘tables’ (you model tables and screens and ‘codeunits’ (which are where you put central code), but it creates the actual database tables for you – in fact, you really should NOT create tables outside of the tool. You may add indexes externally, but you usually create the primary key and main indexes using code.

For the UI, it trades a standard look and feel and some nice built-in functionality for sorting/searching/downloading to excel, for flexibility and fine control. Through code you add ‘fields’, and can group the fields, but you leave how it’s displayed to the framework. There are a few named styles you can apply, but you cannot tweak any more than that – you can’t set colours or mess with the layout much (apart from the order things appear). That is also a strength though – users familiar with a few screens will take to news ones immediately, as they look and work the same.

The coding is very ‘data driven’. You cannot really do anything until you design a table or two. You can use basic wizards in the MS Visual Code tool to then generate a screen (or a page as they are called) from that table. Then maybe add a CodeUnit if you have a lot of custom business logic to apply. Speaking of development, you pretty much are locked into using the MS Visual Code Tool to do anything. You download the AL extensions to it, get a docker image with Business Central and a cut-down database on it, and hook the two up. You cannot run AL code without it running inside a running Business Central instance – so it’s best to have a running docker image with everything good to go. The IDE through a push of F5/F6 builds and deploys your extension into Business Central, and you can then find your screen or run from a menu option to test.

That’s what you have to realise – BC development is all about ‘extensions’ – extending existing tables and/or screens, or adding in your own, but they don’t ever run stand-alone.

Here’s an example of building a docker image running Business Central. You will need some kind of license to run it – I can’t help with that. It’s version 16. Run (probably best as admin) a PowerShell window:

> docker pull

Then copy and paste below into a .ps1 powershell script and call it to do the install:

$accept_eula = $true
$accept_outdated = $true
$licenseFile = "C:\Users\xxxx xxxx\license\7271602.flf"
$containerName = 'D365BC16NavUser'
$artifactUrl = Get-BcArtifactUrl -type onprem -country gb -version 16 -select latest
$login = "admin"
$password = "xxxxx"
$securepassword = (ConvertTo-SecureString -String $password -AsPlainText -Force)
$credential = New-Object System.Management.Automation.PSCredential($login, $securepassword) New-BCContainer -accept_eula:$accept_eula -containerName $containerName -artifactUrl $artifactUrl -licenseFile $licenseFile
-auth NavUserPassword -credential $credential
-accept_outdated:$accept_outdated -enableTaskScheduler:$false
-isolation hyperv `

Anyway – at some point I may share any tips where I’ve found a solution I couldn’t find good documentation for. In fact that’s another thing – Business Central’s developer documentation looks initially good, but has hardly any examples and you soon realise there’s very little else help out there. I think Microsoft wants you to use their dev partners not learn and do it yourself! I’ve been playing with Power Automate to ‘workflow’ Business Central, which is harder because we use ‘on-premises BC not the cloud offering.

By Krispy Brown

Developer (Java / PHP / MS Business Central AL).
Beer brewer and drinker.
DIY Punk promoter.