NAV Automated Patching Process

This post is a very high level over view on how you can automated the patching process when code needs to be ran on the client machine. There are a lot of ideas and topics that are skimmed over as you probably already have some patching process in place for your client sites.

clock-70189_1280

Patching

Manually patching a client site is almost always an easy, strait forward task. Patching usually involves importing and compiling a few updated objects, and maybe altering some data to fit the new processes and table structures. Doing this process manually is ok, if it only takes you an hour or so, and you have a small number of client sites. Some patches can be done without manual intervention if you are only updating objects and don’t need to mess with data. The problem with manual patching is when you have to update 1000+ client sites. Even with five people patching sites, the process would take around 5 weeks of work if there was a manual task that needed to be done at each site. So how can we automate patching?

soap-673176_1280

SOAP

Using the Dynamics NAV SOAP services we can make a method that allows us to run code as we are patching. This code would be imported either before or after the main patch, when ever it needs to be ran. And the call to a SOAP method would run the imported code to do a multitude of things. You could update data before a table definition change is made. Copy over data before you delete a table. Pretty much anything you can write in C/AL.  For details on how to set up a SOAP service on a NAV instance you can browse through the MSDN documentation.

The Codez

When our patch runs we need our fix codeunit to be imported and compiled. There are a few different ways to do this based on the version of NAV you are running. For 2013 you can use Finsql.exe included with NAV to import/compile the codeunit, For 2015 there are Powershell scripts that do the same thing. For 2009 and before you might be out of luck.

After our codeunit is imported and compiled we need to run it with the SOAP service. This can be done with a small application programmed in the language of your choice, as long as it is able to call a SOAP web service. The method it needs to call is as follows:

Run CodeUnit

I would also suggest that after your fix codeunit has ran that you import a blank codeunit so that you remove the risk of running your fix again. Depending on the fix this could cause major issues.

Leave a Comment