Journal
Field notes from our Business Central work.
Every post from our blog, republished in full — practical patterns from the kind of problems you only see once you're deep inside a live system. Six posts in total, from 2020 to 2021.
On-prem · Multi-DB
28 · Jul · 2021
~ 4 min read
Running multiple Business Central web clients against different databases on a single on-premise server.
A short, practical walk-through: how to spin up several independent web clients for Business Central 18 on-premise, each pointing at a different database within the same environment — useful when you want production and sandbox users on the same box without them stepping on each other.
The six steps
-
Create a new server instance
Open the Business Central Administrator and create a new server instance, giving it a port different from the default instance.
-
Create a matching web instance
A server instance on its own won't serve the browser — create a corresponding web server instance so the web client has somewhere to live.
-
Use the right PowerShell command
From the Business Central Administration Shell, run
New-NAVWebServerInstance with parameters for the web server instance name, localhost, and the server instance name you created in step 1.
-
Edit the navsettings file
Open the
navsettings file at C:\inetpub\wwwroot\[Web Client Name] and adjust the configuration so the web client talks to the correct server.
-
Align the ports
Make sure the port in
navsettings matches the port you assigned to your server instance back in step 1. Mismatched ports are the single most common reason this breaks.
-
Restart both services
Restart the server instance and the web instance together to apply the configuration. You should now be able to open each web client in its own browser tab, each talking to its own database.
AL · File I/O
22 · Sep · 2020
~ 5 min read
How to upload and download a file in Business Central using InStream and OutStream.
A compact pattern for handling file uploads and downloads inside Business Central — works with text documents, PDFs and images (JPG, PNG), using only InStream for reading data into a table and OutStream for extracting it back. No external storage, no third-party libraries.
The four steps
-
Create a table to store the file
Define a table with a
Blob field. This is where the actual file contents will live — one row per uploaded file.
-
Create a page on that table
Add a page bound to the table, with two actions: one for Import File and one for Export File. These will be the user-facing buttons in the role center.
-
Write the upload and download functions
Create two AL functions: one that takes an
InStream of the incoming file and writes it into the Blob field, and one that reads from the Blob field into an OutStream and serves it back to the user.
-
Wire up the page actions
Call the upload function from the Import action's
OnAction trigger, and the download function from the Export action. That's the whole pattern — it works uniformly across TXT, PDF and image files.
Release notes
18 · Sep · 2020
~ 6 min read
Microsoft Dynamics 365 Business Central — September 2020 Wave 2, field notes.
Microsoft released Business Central 17 with a batch of features in public preview this month. Here's what actually made it into our short-list of things to use on real client engagements — and what we've quietly ignored.
Five features worth knowing
-
Contact conversion templates
Users can now convert a contact into a vendor or an employee using configurable templates that auto-populate the relevant fields during the conversion. Small change, big quality-of-life improvement for busy AP teams.
-
Retention policies
Administrators can now define policies that tell Business Central how frequently to delete outdated data — log entries, archived records and more. Policies support filtering so you only delete what's actually expired. Finally.
-
Default unit cost for service items
You can now set default unit costs for non-inventory and service items directly on item and SKU pages, reducing the manual data entry that every controller has complained about since NAV.
-
Feature management enhancements
When enabling features that require data modification, administrators can now schedule the data update ahead of time. The Feature Data Update setup guide lets you inspect exactly what will change before you pull the trigger.
-
OAuth 2.0 for the Outlook add-in
Business Central is switching the Outlook add-in from basic auth to OAuth 2.0, lining up with Exchange Online's deprecation of basic auth planned for H2 2021. Worth flagging early for anyone still on the old deployment.
Reporting · RDLC
01 · Jul · 2020
~ 5 min read
Creating an RDLC report in Business Central 365.
A step-by-step walkthrough for building a classic RDLC report in Business Central using AL and Report Builder — from the first Treport snippet to a published app, plus the export / import / edit cycle for tweaking the layout later.
Creating the report — eight steps
-
Open Visual Studio Code
Configure your workspace settings in
launch.json so Code knows which BC server and tenant to connect to.
-
Download symbols
Press
F1 and run the AL: Download Symbols command — without symbols, the AL compiler can't resolve base objects.
-
Create an AL file
Add a new file with the
.al extension — for example, TestReport.al.
-
Scaffold with
Treport
Type Treport inside the file and accept the snippet — Code generates the skeleton of a report object for you.
-
Configure ID, name and columns
Set the report ID and name, and add the columns you need with proper
SourceExpr expressions. On compilation, Business Central will auto-generate the .rdlc file as long as the report isn't marked processingOnly.
-
Open the project folder
Navigate to your project folder and open the generated
.rdlc file in Report Builder to work on the layout.
-
Design the layout
Lay out the report in Report Builder — headers, groupings, totals. Save when done.
-
Publish and test
Back in Code, publish the app with
F5. Search for your report inside Business Central and run it to confirm everything lines up.
Exporting, editing and re-importing the layout
-
Find your report in Custom Report Layouts
In Business Central, open Custom Report Layouts and locate your report.
-
Export the layout
Download the
.rdlc layout file to your machine for offline editing.
-
Import the edited layout
Once you've reworked the layout in Report Builder, import it back via the same screen to replace the existing version.
Dev workflow · VS Live Share
30 · Jun · 2020
~ 3 min read
Developing NAV / Dynamics 365 Business Central extensions with real-time collaboration.
Visual Studio Live Share — announced by Microsoft at Build 2018 — lets developers write code together in real time. For anyone building AL extensions for NAV or Business Central, it turns pair programming across continents into a one-click affair.
Getting set up — six steps
-
Install the extension
In VS Code, open the Extensions marketplace and search for Live Share. Install it and reload if prompted.
-
Sign in
Click the Sign in link in the status bar. You can authenticate with a Microsoft personal account, a corporate account, Azure AD or GitHub.
-
Start a sharing session
Once signed in, click the Share button. Live Share generates an invite link and drops it straight onto your clipboard.
-
Invite a colleague
Send the link to whoever you're collaborating with. As they join, you'll see them appear in your sidebar.
-
Write code together
You can now see each other's cursors and edits in real time — effectively a shared AL workspace, without anyone having to pull your branch.
-
End the session cleanly
Click your name in VS Code to find Leave collaboration session (for guests) or End collaboration session (for the host) when you're done.
NAV · Security
29 · Jun · 2020
~ 8 min read
NAV 2013 R2 Windows client with NavUserPassword — introduction.
A comprehensive four-part guide for configuring Microsoft Dynamics NAV 2013 R2 to use the NavUserPassword credential type across both Windows and Web clients — the prerequisite to running NAV outside a pure Windows-authenticated domain.
Part 01 · Creating the security certificate
-
Open the Visual Studio Command Prompt
You'll need the
Makecert utility, which ships with the Visual Studio tooling.
-
Generate the certificate, private key and CRL
Use
Makecert to produce the certificate file (.cer), the private key (.pvk) and the certificate revocation list (.crl) — all three are required for WCF to validate the chain.
Part 02 · Installing certificates on the NAV server
-
Import into Windows Certificate Manager
On the NAV Server machine, open certmgr.msc and import the certificate artefacts you generated in Part 01.
-
Place them in Trusted Root Certification Authorities
Install the certificates under the Trusted Root Certification Authorities store so the machine trusts them implicitly.
-
Grant NETWORK SERVICE access to the private key
The NAV service runs under NETWORK SERVICE by default — give it read permission on the private key, or the service will fail to start.
Part 03 · Configuring the NAV service
-
Create a new NAV service instance
Spin up a new service instance dedicated to the
NavUserPassword credential type so you don't break your existing Windows-authenticated instance.
-
Assign the certificate thumbprint
Paste in the thumbprint of the certificate from Part 01 so the service knows which certificate to present.
-
Set the port numbers
Use ports
1245 through 1248 for the various services (management, client, SOAP, OData) — and make sure they don't collide with an existing instance.
Part 04 · Configuring the Windows client
-
Edit
ClientUserSettings.config
Update the port, server instance and credential type entries to match what you set up in Part 03.
-
Point the client shortcut at the new config
Modify the NAV Windows client shortcut so it references your custom
.config file — then launch and you should be prompted for a NAV username and password instead of silently authenticating with Windows.