I’m building an App to work with ForNAV. If you haven’t you should read earlier posts first or watch the YouTube channel.
New Blog Series | Building the ForNAV App
Step 1 – Renumbering | ForNAV App Building
The next step I will blog about is how to make notifications work for you.
Notifications are very useful when you want to ask something from the user without sitting on their face and be rude.
I am going to use a notification to indicate that ForNAV is installed but not yet setup. This can happen if people install the fob or if they activated the extension.
This will be the notification users will see:
To show this notification I have created 4 codeunits:
Let’s start with the first and look at the code:
You can see I have an EventSubscriber that subscribes in my case to OnFindPrinter in Codeunit 1. Some people like to subscribe to Activity Pages of Role Centers but what if someone uses my App in a database with new rolecenters.
ForNAV is a report tool so why not remind them to setup when they do printing.
In fact, Microsoft should provide a generic handle for notifications like this.
Anyway, I throw a notification, but I don’t want to show the notification when the setup if already done, or if the user does not want to setup ForNAV and disables the notification.
The notification has an ID and two actions. “Yes” would be the prefered one or “No” if for whatever reason they don’t want to do the setup.
The Actions are handled in a seperate codeunit. The first action starts the setup process which uses a wizard. More about that in the next blog.
The second action checks if the notification exists in the MyNotifications table and disables.
NAV 2017 has a table that stores notification preferences. This is table 1518 My Notifications and the Page that belongs to this table supports the “Discovery Event” pattern. This means I can hook into this page and “insert” myself the first time this is possible.
I can do this using the “InsertDefaultWithTableNum” function.
The last codeunit is a silly one, it returns the GUID as a string. This GUID is used in three different places in my code and I don’t want to change it in three places when I have to.
Let me end with a teaser for the next blog, a Setup Wizard. This is what you get when you hit “Yes” on the notification.
Ok, so as I wrote earlier this week I have been asked to build an App for ForNAV to provide with a set of “superior” reports that work optimized with the designer.
To do that I first build a prototype based on an initial interview and the prototype was approved. You can find the prototype on GitHub and run the reports in a NAV2017 database using the free download on www.ForNAV.com.
The prototype was created in the 84xxx series which is more like a trip down to memory lane for me as this was the range I build my first large ISV solution in.
Now we need to renumber it to our ForNAV range which is strangely enough 6188471 – 6189470. No, it’s not a joke and it will take me a while to learn these numbers by heart.
Now what options do we have or which tools can we use. I’ve actually listed a few with pro’s and con’s
If you know what you are doing you can renumber in notepad, and I typically do that if I have a few objects and the renumbering is a one-time job.
In this case I don’t want to use notepad since I have quite a few objects and my objects are reports which use the RDLData section which might accidentally contain the same integer values.
Since as long as I remember I’ve used the classic renumbering tool from a classic database. Your database only has to be 1000kb and with a small tweak it also renumbers pages.
I would have used this tool if it would also renumber my fields but it does not do that. Let’s move to the next option.
Gunnar Gestsson has created a variant for the three-tier environment and loaded it with DotNET power. You can download and read about it here.
It seems like a good option and the suggested ID feature is quite nice since it will look at your license and check for available objects. Neat.
Unfortunately it also does not renumber my fields.
Since a few weeks we have a new option. Microsoft (Freddy Kistiansen) created a renumber tool which can be used in PowerShell or from the Dos Command line.
To install this tool you need to have some knowledge of Visual Studio since the dll is not provided, you have to create it yourself. I think this will prevent some to use it in our NAV ecosystem.
After you’ve downloaded the files from the GitHub you can use the compiled DLL in PowerShell but it took me a few moments to get my head around the script and I’ve actually made a small change to make more sense to me.
This script, once you get it working, has some advantages. First of all it will also renumber any fields you have used but it will also renumber WebService definitions, Delta files and the new AL format for VSCode.
So this is my choice and even though automation is not one of my requirements I am going to keep this script and you can find it together with the DLL on my own GitHub.
There is so much to blog about when you are a Dynamics NAV developer, it’s almost unreal and I can imagine that a lot of bloggers don’t know where to start.
I am in that situation and very fortunate to have found something to hold on to.
Many of you will remember the post on my blog How I fell in love with ForNAV and some of you might have seen some of the webinars I did for ForNAV.
I don’t work for ForNAV, technically they are my customer, but as with all my customers I feel as if I am part of the team. I guess it is the work situation I am most comfortable with.
You can follow the project here on GitHub.
As you know ForNAV is a report designer and most of the development work (actually all of it) is done outside of AL. Well, until now.
With the designer being finished we got a lot of questions to build reports that are optimized to work with it. This makes sense since ForNAV has a lot of controls that don’t exist in classic reports and neither in RDLC. So you can convert all you want but your converted reports won’t make use of the design patterns.
Also it’s a public secret that Microsoft did not do a whole lot of optimization to the reports after they have been converted from classic to RDLC and my are 20 years old from a design perspective.
The webinar that I did where I build a customer top 10 list in a few minutes is a good illustration of this situation.
Based on the situation the idea was born to create a set of reports which are optimized to work with ForNAV and follow the Dynamics NAV DNA about simplicity and design patterns and I got asked to make them. Go figure.
More important for you as a loyal reader of my blog, I got permission to blog about every step of this process. How cool is that?
Most of the blog posts that I wrote, especially the tips and tricks, are based on real life scenarios without mentioning the project I was working on.
Is this advertisement for ForNAV? Well, I hope so because it is a great product.
The list of topics that I want to cover is pretty wide. The project is going to be open source so we will start with Source Code management. I’ve decided to use GitHub based on experience and being impressed by the Microsoft AL project.
Our reports should work with as many localizations as possible from a single code base which means automated testing is mandatory. I don’t want to spend most of my time running reports and comparing them to test if the values are ok.
To do this we will use PowerShell, the Testability Framework and SQL Server.
I am going to leverage as many design patterns as possible. I’m also using reflection and polymorphism.
ForNAV works flawlessly with NAV design patterns and you will see a lot of them being used in reports and the NAV objects.
We are not going to touch existing code, yet we want to execute our reports and processes after you’ve installed our product. For this I’m going to leverage events and extensions. If you want you can install the product as an extension. This also means I will ship upgrade codeunits with each version which you can also use if you don’t install ForNAV as an extension.
One of the best features of NAV 2017 is the assisted setup, tooltips and general simplification. When implemented correctly this minimizes support and maximizes growth.
Implementing Notifications and Setup Wizards is not only useful when you want to go to AppSource, it is also useful when you want to create a highly repeatable solution that people can install on prem.
Last but certainly not least, all of the code will also be available in VS Code and the optimized AL language. I’ll investigate the conversion tool that Microsoft has announced for one of the next updates of the development preview.
Now I know that I am infamous for not finishing my blog series and I guarantee nothing.
You can however expect the first blog post this week, hopefully even two.