Posts

O(Auth) brave new world

Image
With Microsoft's declaration of intent to remove support of basic authentication for cloud Business Central instances, it's time to start figuring out the not-so-new kid on the block: OAuth.  OAuth (Open Authentication) has been around for some time now and it provides many advantages over legacy methods.  One of the biggest ones has been Single Sign On.  Rather than having to create a multitude of accounts for an ever growing list of websites, you can use you Gmail account or Facebook login.  The client site then gets a token that is unrelated to your actual credentials and you have one less password to worry about.  Of course, this all comes at a cost and it can be pretty painful if you have any applications that need to be migrated and you are on the bleeding edge where documentation is sparse and a bit confusing.  After trudging through the muddy waters of Business Central OAuth documentation, I'm pleased to say I've come out the other side and I can n...

Putting SOAP on a rope (part 1)

Image
First, forgive the title of this post.  I couldn't help myself. Now that we're past that, every now and then I get called on to make SOAP work for customers.  It used to be pretty popular back in the day (2009-ish) but now REST (specifically OData in the NAV/BC world) is all the rage.  I like OData, it's easier to work with for most purposes but even now there are still a few things that SOAP is better at.  One thing that makes SOAP difficult is that it's got a more complex structure and is not easily understood.  With OData, you just set your verb and give it a little JSON and you're up and running.  I recently had to help someone get SOAP working and in the process I debugged the calls with Wireshark and Fiddler and I wanted to document what I got out of that.  It might just help me a few years from now and help someone else sooner. First the basics.  In the interest of being complete, I'll jot down the first steps just in case anyone else is lo...

When you are falsely accused of not having SQL Server Report Builder installed

Today I was updating some report objects from a text file for an older BC13 upgrade.  Yes, even at this late date BC13 can be an "upgrade".  Long story.  Anyhow, in the process of pulling in reports I got an error message To upgrade reports, you must have Microsoft SQL Server 2016 Report Builder installed. The problem is, I did have SQL Server 2016 Report Builder installed.  Some cursory Googling revealed that someone else had run across this and their solution was to install an older version of the report builder.  Not satisfied with this option, I ran the import under Process Monitor .  Process Monitor showed that BC was looking for Microsoft.ReportingServices.RdlObjectModel.dll and not finding it.  Sure enough, that file was nowhere to be found.  I did find an article on that indicating that it was a part of older report builder installations and I managed to find it on my development system under some Docker containers (of all places)....

Debugging a Sandbox by Any Other Name

Image
 Recently, I've noticed that trying to debug a sandbox that isn't named "Sandbox" has not worked.  The first few times I just worked around it but I finally came to a place where I couldn't ignore it anymore.  While my extension was deploying to the correct sandbox, the browser was opening to the default sandbox and errors were just causing the web client to hang and VS Code's debugger to terminate.  The solution was pretty simple: there is a server option in the launch.json that you can use to specify the correct URL.  Once I did that, debugging worked as it should.

Accessing AL Extension Source Code in BC

Image
For a while now, I've noticed that the Visual Studio Code feature that pulls up source code from other extensions (including system extensions) doesn't behave as one might expect.  Sometimes it pulls up the full object code and other times it pulls up a skeleton.  For instance, I just pulled up the definition for the Res. Journal Line table and this is what I got.  Nothing but field and variable declarations. Now look at what happens when I pull up the definition while debugging my extension in a Docker container. Notice the difference?  The results seem to be cached with the project, as once I've pulled the definition with the debugger active I can pull it again anytime and get the full source.  I don't believe this will work using a BC sandbox environment but if I find otherwise, I'll post it.

NAV 2018 Styles

Image
The NAV Style/StyleExpr properties have been around for a while but I couldn't find an accurate table of the values as they are circa 2018.  Hence, a quick little reference:

Adding XML Formatting to a Web API Controller

Image
A .NET API project will return JSON by default but sometimes you need something else.  By adding a new input and output formatter, you can accomplish this.  The ConfigureServices function in the Startup.cs file can be changed with the following code:             services.AddMvc(options =>             {                 options.InputFormatters.Add(new XmlSerializerInputFormatter(options));                 options.OutputFormatters.Add(new XmlSerializerOutputFormatter());                 options.OutputFormatters.Add(new StringOutputFormatter());             }); You will also need to be using Microsoft.AspNetCore.Mvc.Formatters.