Testing Against a Remote Docker Host with AL Test Runner
Feb10

Testing Against a Remote Docker Host with AL Test Runner

Apologies for another post about AL Test Runner. If you don’t use or care about the extension you can probably stop reading now and come back next time. It isn’t my intention to keep banging on about it – but the latest version (v0.2.1) does plug a significant gap. Next time I’ll move onto a different subject – some thoughts about how we use Git to manage our code effectively. Developing… Continue...

Read More
Remote Development with VS Code and AL Test Runner
Jan28

Remote Development with VS Code and AL Test Runner

The most obvious limitation of the AL Test Runner extension for VS Code has been that you need to run VS Code on the Docker host machine. That’s fine for us because we do all our development on local Docker containers but I’m aware that this isn’t everyone’s preferred process. Local Repo and VS Code, Remote Docker Host I guess if you’re not hosting the Docker container locally then you… Continue...

Read More
Scheduling Azure DevOps Pipelines with YAML
Jan15

Scheduling Azure DevOps Pipelines with YAML

I had the pleasure of presenting some thoughts about developing apps for SaaS with James Crowter to the Dutch Dynamics Community yesterday. We were sharing some of our experiences of the maintenance challenge that comes with having published apps on AppSource. How can you continuously test your apps against past, current and upcoming versions of Business Central? Perhaps two ways: Slowly… Continue Reading james’s Article...

Read More
Putting Queries to Use in Business Central
Jan08

Putting Queries to Use in Business Central

We’ve had query objects for a while now – since NAV 2013 (I think). In theory they sound great, link a bunch of tables together, aggregate some columns, get distinct values, left join, right join, cross join – executed as a single SQL query. Why Don’t We Use Queries Much? In practice I haven’t seen them used that much. There’s probably a variety of reasons for that: We have limited… Continue...

Read More
AL Test Runner 0.1.15
Dec24

AL Test Runner 0.1.15

This is a brief update about the AL Test Runner extension that I’ve been working on for VS Code. I’ve had some great feedback and suggestions via GitHub, a pull request correcting me being a muppet and 300-odd installs so far. Thanks to everyone who has got involved to improve it. This version includes a new setting “Publish Before Test” which allows you to invoke either the “Publish… Continue...

Read More
Some More About Translating Business Central Apps
Dec16

Some More About Translating Business Central Apps

I’ve written before about using Azure Cognitive Services to translate the captions in the .xlf file that is generated when you compile your Business Central app. For us, the motivation is to make our apps available in as many countries as possible in AppSource. Since then Søren Alexandersen has announced that it will not be necessary to provide all of a country’s official languages to make… Continue Reading...

Read More
AL Test Runner for Visual Studio Code
Nov18

AL Test Runner for Visual Studio Code

TL;DR I’ve written an extension for VS Code to help run your AL tests in local Docker containers. Search for “AL Test Runner” in the extension marketplace or click here. Feedback, bugs, feature suggestions all gratefully received on the GitHub repo or james@jpearson.blog Intro As soon as Freddy added capability to the navcontainerhelper module to execute automated tests I was excited… Continue Reading...

Read More
Prompting the User for Input with PowerShell
Nov08

Prompting the User for Input with PowerShell

Sometimes you need to prompt the user to provide some value before you can complete your PowerShell script. You’ve got a few different options depending on what you’re asking the user to select from. Parameters Setting a parameter as mandatory without providing a value will prompt the user to enter one, like this: function Invoke-AmazingPowerShellFunction { Param( … Continue Reading james’s Article on their...

Read More
Satisfying Your Case-Sensitive Obsession with Regex
Oct23

Satisfying Your Case-Sensitive Obsession with Regex

Obsession is probably a little strong, but I do like tidy code. You know – proper indentation, a sensible number of comments (which can be more than none but there shouldn’t be as much comment as code) and good names. Hungarian notation brings me out in a rash. This extends to having keywords, variables and methods in the right case. While in CAL there was a lot of UPPERCASE, in AL there is… Continue Reading...

Read More
You Can Ditch Our Build Helper for Dynamics 365 Business Central
Oct22

You Can Ditch Our Build Helper for Dynamics 365 Business Central

I’m a bit of a minimalist when it comes to tooling, so I’m always happy to ditch a tool because its functionality can be provided by something else I’m already using. In a previous post I described how we use our Build Helper AL app to prep a test suite with the test codeunits and methods that you want to run. Either as part of a CI/CD pipeline or to run from VS Code. Freddy K has… Continue Reading...

Read More
Stop Writing Automated Tests and Get On With Some Real Code
Oct14

Stop Writing Automated Tests and Get On With Some Real Code

To be fair, these weren’t the exact words that were used, but a view was expressed from the keynote stage at Directions last week along these lines. Frustration that developers now have to concern themselves with infrastructure, like Docker, and writing automated tests rather than “real” code. I couldn’t resist a short post in response to this view. If It Doesn’t Add Value, Stop Doing… Continue...

Read More
Debugging the Next Session in Business Central
Oct04

Debugging the Next Session in Business Central

Business Central v15 includes some good new stuff for developers. Access modifiers for objects, smarter code analysis, background page tasks – there is a list of stuff here: https://docs.microsoft.com/en-us/dynamics365-release-plan/2019wave2/dynamics365-business-central/developer-tools I’ve just been trying out the new debugger capability, specifically being able to attach the debugger to… Continue Reading...

Read More
Using Templates in YAML Pipelines in Azure DevOps
Oct01

Using Templates in YAML Pipelines in Azure DevOps

So far we’ve been considering how you can define a yaml pipeline to define the steps required to build the code in a single repository. Create a .azure-pipelines.yml file, add the stages, jobs and steps and away you go. Cool. What if you’re building multiple apps with the source code in multiple repositories though? You could just copy your pipeline definition from repo to repo. What… Continue Reading james’s...

Read More
YAML Multi-Stage Pipelines in Azure DevOps, Stage 2
Sep25

YAML Multi-Stage Pipelines in Azure DevOps, Stage 2

In the previous post I introduced you to multi-stage YAML pipelines. Build/Release pipelines vs. a multi-stage pipeline, enabling the preview feature (it’s still in preview at the time of writing) and an overview of the structure of the file. Now we’ll take a more detailed look at an example multi-stage YAML file. This is geared at building apps for Business Central but the principles are… Continue Reading...

Read More
YAML Multi-Stage Pipelines in Azure DevOps, Stage 1
Sep19

YAML Multi-Stage Pipelines in Azure DevOps, Stage 1

Let’s return to the subject of pipelines and this time let’s talk multi-stages. What is it and why might you want to implement it in your YAML file? Builds/Releases With the approach that Microsoft are now calling “classic” pipelines there was a definite division between a build pipeline and a release pipeline. A build starts with a given version of your source code (a particular… Continue Reading...

Read More
AL Build Helper for Dynamics 365 Business Central Builds
Sep12

AL Build Helper for Dynamics 365 Business Central Builds

If you’re interested in setting up a build pipeline to build apps for Business Central then you’re probably interested in running the automated tests as part of it. (I take it you are writing automated tests?) Turns out getting your test codeunits and methods populated into a test suite ready to run isn’t straightforward. We use a separate “Build Helper” app that exposes a couple of web… Continue...

Read More
Dynamics 365 Business Central Queries: Erm…where are the rest of my rows?!
Aug08

Dynamics 365 Business Central Queries: Erm…where are the rest of my rows?!

This is a bit off-topic to what I’ve been blogging about lately but I’ve been caught out by this before and the other day so was a colleague so I thought it was worth a post. TL;DR Be careful of the difference between DataItemLink and DataItemTableFilter properties. DataItemLinks define the join between the dataitems in the query while DataItemTableFilters are applied to the results… Continue Reading james’s...

Read More
Working with Translations in Dynamics 365 Business Central
Jul31

Working with Translations in Dynamics 365 Business Central

Intro Languages: what an almighty headache. Computerphile have a great video that describes just how big the problem is: https://www.youtube.com/watch?v=0j74jcxSunY Perhaps my perception is skewed by my ignorant native-English-speaker point of view. I haven’t grown up in a country where learning multiple languages and being able to switch between them is essential. Sure, I wish* I could… Continue Reading james’s...

Read More
Building Microsoft Dynamics 365 Business Central Apps on Azure DevOps Hosted Agents
Jul09

Building Microsoft Dynamics 365 Business Central Apps on Azure DevOps Hosted Agents

This is a quick follow up to this post. If you want an intro to building AL apps for Business Central you might want to check that out first. In order to build your apps you need a build agent running somewhere which will listen for new jobs and run the scripts, create the Docker containers, run the tests or do whatever else you define in the build file. You can install an agent on your… Continue Reading james’s Article on...

Read More
Building Microsoft Dynamics 365 Business Central Apps with Azure DevOps
Jun24

Building Microsoft Dynamics 365 Business Central Apps with Azure DevOps

Last time out we were discussing defining your build pipeline in a YAML file. That post was an intro to what pipelines are and the benefits of defining the tasks that it runs in a YAML file alongside your other source code. Now we’ll turn our attention to some Business Central specific considerations. Objectives We’re start by defining the key objectives of the build… Continue Reading james’s Article on their...

Read More

Working with Azure DevOps Pipelines in YAML – James Pearson

Overview This post is an update to a post I made about YAML pipelines here. We’ll also take the opportunity to discuss why you might want to define a pipeline with YAML. Wait…What? What the heck are we talking about? (skip this bit if you do know what we’re talking about) A pipeline defines a series of tasks, running on defined environments that are performed with your code…. Continue Reading james’s Article on their...

Read More

Testing Your Microsoft Dynamics 365 Business Central Tests – James Pearson

Seeing as I’m on a bit of a run of posts about testing, let’s look at it from a slightly different angle. Testing the Test If we’re going to rely on automated tests to verify that our code (still) works then we need to have confidence that the tests themselves actually work. Writing the Test First This is why it is helpful to write and run the tests first. When you start developing a… Continue Reading james’s Article on...

Read More
Part 3: Testing Microsoft Dynamics 365 Business Central from VS Code
May01

Part 3: Testing Microsoft Dynamics 365 Business Central from VS Code

Another instalment of my musings on running automated tests for Microsoft Dynamics 365 Business Central from Visual Studio Code. Objective What are we up to this time? As a brief reminder, I’m trying to make it as easy as possible to run automated tests from Visual Studio Code. I figure the faster and simpler it is to publish your code changes and run the tests the more inclined you are going… Continue Reading...

Read More
Part 2: Testing Microsoft Dynamics 365 Business Central from VS Code
Apr29

Part 2: Testing Microsoft Dynamics 365 Business Central from VS Code

Last time out we went through running automated tests from the PowerShell terminal integrated into VS Code. We saw that you could define a task in the tasks.json file to run the tests and assign a keyboard shortcut for that task. Great. But. In order to run tests they first need to have been added to a test suite. You could add some code to an install codeunit in your app to do that for you (

Read More

Testing Microsoft Dynamics 365 Business Central from VS Code – James Pearson

Execute your Microsoft Dynamics 365 Business Central tests – with a keyboard shortcut – without leaving the comfort of your favourite IDE. What’s not to love? Background We’ve come a long way with testing our apps in Microsoft Dynamics 365 Business Central / NAV. By “we” I mean our internal development practices but also the capabilities of the platform. We didn’t have any… Continue Reading james’s Article on their...

Read More

Calling SOAP Services from PowerShell – James Pearson

Like most of my posts this has its origin in Microsoft Dynamics 365 Business Central development – specifically our build process – although it isn’t limited to that. We had a need to call a SOAP web service from PowerShell (see below for the background if you’re interested). In the past I’ve used Invoke-WebRequest and added content-type and a SOAPAction header to the request.

Read More

Chaining Builds in Azure DevOps – James Pearson

We are triggering a lot of builds in Azure DevOps these days. If anyone so much as looks at an AL file we start a new build. OK, that’s a small exaggeration, but we do use our build pipelines for: Continuous integration i.e. whenever code is pushed up to Azure DevOps we start a build Verifying our apps compile and run against different localisations (more of that another time) Checking… Continue Reading james’s Article on...

Read More

An Approach to Package Management in Dynamics 365 Business Central – James Pearson

We use PowerShell to call the Azure DevOps API and retrieve Build Artefacts from the last successful build of the repository/repositories that we’re dependent on. Over the last few years I’ve moved into a role where I’m managing a development team more than I’m writing code myself. I’ve spent a lot of that time looking at tools and practices in the broader software development… Continue Reading james’s Article on their...

Read More

Getting Started with the Azure DevOps API – James Pearson

Azure DevOps is pretty sweet. Manage your code, backlog, sprints, builds – the whole caboodle. Also, it has a comprehensive REST API so you can access your data and integrate with DevOps from anywhere you like. Ever since we started with DevOps (VSTS, TFS) we created some PowerShell scripts to integrate with it for Dynamics NAV development. They’ve become an indispensable part of a… Continue Reading james’s Article on...

Read More

Working with Version Numbers in Dynamics Business Central / NAV – James Pearson

Specifically I’m talking about assigning version numbers to your own code and manipulating those versions in CAL / AL and PowerShell. There are lots of different systems for assigning a version number to some code. Some incorporate the date or the current year and day number within the year. Loads of background reading here if you’re interested. The system we typically follow… Continue Reading james’s Article on their...

Read More

5 Things – James Pearson

Visual Studio Code has moved quickly from “what’s that? Part of Visual Studio? No? Then why did they call it that?” to become the hub of much of my daily work. This post contains a few of the things (5 to be precise) that I’ve done to make it work better for me. Maybe you can glean something useful. Maybe you can teach me something about how you use it – post a comment. You can… Continue Reading james’s Article on their...

Read More

Regular Expressions in Visual Studio Code Search – James Pearson

Having spent years developing in C/SIDE I still get a little giddy using Visual Studio Code’s modern IDE features. You know, finding references to a function, renaming symbols, peeking definitions. Also, being able to search across all of your source code. What a dream. Even better, you can search for a regular expression – that very powerful, if not slightly bonkers, way of searching… Continue Reading james’s Article on...

Read More

An Introduction to Pull Requests in Azure DevOps – James Pearson

I’ve previously written about our experience with source control and our eventual migration to Git. I said that pull requests in Azure DevOps are awesome and are one of the biggest reasons to consider the switch to Git. In this post we’ll dig a little more into the details of why they are so good and how to use them. Before we start, don’t forget that code review (i.e. pull requests… Continue Reading james’s Article on...

Read More

Automatically Creating a CI Pipeline in Azure DevOps with YAML – James Pearson

TL;DR Name your yml file .vsts-ci.yml and put it in the root of your project. What Does the Title Mean? There is a lot of chat about build pipelines and continuous integration (CI) at the moment. For the uninitiated let’s break down the title of this post: CI = continuous integration, the practice of integrating ongoing development into your master development branch as soon as… Continue Reading james’s Article on their...

Read More

Integration Between Extensions in Dynamics 365 Business Central – James Pearson

Extensions provide the opportunity for us to write and maintain our code in tidy, discrete blocks. This is good for separating concerns and breaking our functionality into logical pieces. But how do we get those pieces to play nicely together? The topic is probably best discussed with an example. Imagine that you’re writing some functionality to pull some files, handle them in Business… Continue Reading james’s Article on...

Read More

Extensible Enums in Dynamics 365 Business Central – James Pearson

Option fields: great for scenarios where you want to provide a fixed, predefined list of values. Only a single value can apply and the user gets a convenient dropdown to select from. Perfect, until you want to extend the list of values. Enter enums. Documentation is here: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-extensible-enums Enums are… Continue Reading james’s Article on...

Read More

Extension Settings in Microsoft Dynamics Business Central – James Pearson

Recent builds of Business Central introduce a check when your app attempts to call an external service through the HttpClient type in AL. The user will see a message like this: “The extension [extension name] by [publisher name] is making a request to an external service. Do you want to allow this request?” This decision is saved into the database and is editable from the… Continue Reading james’s Article on their...

Read More

“About This Page” in Dynamics NAV 2018 – James Pearson

My original post about adding some “About this Page” functionality to the web client for Dynamics 365 Business Central has received a bit of attention – enough to demonstrate that there is demand for this in the standard product. Hopefully, this is something that Microsoft will address in time. They certainly won’t address it, however, for Dynamics NAV 2018. You’ve still got… Continue Reading james’s Article on their...

Read More

Business Central Tenant Management – James Pearson

One of our apps calls for Business Central to communicate with our external service some key details about the tenant: The Azure tenant id The type of environment (production or sandbox) but how to get at those details? Maybe I’m a simpleton and maybe the information is out there somewhere and I just couldn’t find…but I couldn’t. Turns out there is a codeunit (#417)… Continue Reading james’s Article on their...

Read More

Business Central Development With CI/CD – James Pearson

If you follow blogs about Dynamics 365 Business Central / NAV development, attended development sessions at Directions or have seen the schedule for NAVTechDays then you may have noticed the terms “CI/CD” or “pipeline” being thrown around. What do those terms actually refer to? And how does it affect the way we approach development? CI = “continuous integration”CD =… Continue Reading james’s Article on their...

Read More

“About This Page” in Dynamics 365 Business Central – James Pearson

We’re entering a brave new world of web-client-only experience with Dynamics 365 Business Central. That is simultaneously great news and presents a challenge for those who know and love the Windows client. It doesn’t take long for most consultants to realise that they can’t view the “About this Page” (Ctrl+Alt+F1) page in the web client – and to get upset about that. In my… Continue Reading james’s Article on their...

Read More

Source Code Management: Conclusions – James Pearson

I stated in the first post in this series that I wasn’t going to offer any advice. I will, however, attempt to draw some conclusions from our experiences and hope that you’ll find them helpful, or at least interesting. A few months before we trialled Git in earnest as a team I tried it out for myself. I had a look because I’d heard various reasons that we should… Continue Reading james’s Article on their...

Read More

Source Code Management: Migrating to Git

This is the third post in a series about source code management. You can start here if you haven’t read the others in the series. There we were, happy as the proverbial Larry, checking our code into TFVC, requesting code reviews, branching, merging, viewing file history, comparing versions, annotating and writing a lot of PowerShell to automate tasks with the VSTS API. We were feeling pretty… Continue Reading james’s...

Read More

Adopting TFVC – James Pearson

This is the second post in a series about source code management. If you haven’t already read the beginning of the story you can find it here. We’d realised that we’d outgrown our system of one-developer-per-customer and ad-hoc communication between teams about ongoing changes to objects. We needed some more structure and somewhere safe to keep previous versions of objects. We… Continue Reading james’s Article on their...

Read More

A Trilogy in Four Parts – James Pearson

It seems hard to believe now that we ever developed working software without using any source code management system – but we did. For a long time. And judging by the straw polls taken in sessions at NAV conferences lots of partners still do. In this series of posts I am not intending to dispense any advice based on my own meandering experiences. I’m not Baz Luhrmann. I’ll also… Continue Reading james’s Article on their...

Read More

great, but not just for that reason – James Pearson

It’s easy to imagine that code review is just about monitoring the quality of the code. Squashing bugs, checking best practices have been followed, sniffing out code smells etc. It is good for that. Having someone other than the original author cast an eye over the development is useful – it’s very difficult to objectively check code that you have written and think already works… Continue Reading james’s Article on their...

Read More