Microsoft Flow Integration one way only

Last week I was preparing a new How Do I video about the integration of Microsoft Flow with Microsoft Dynamics NAV 2017. As you might know Microsoft Flow is a platform were you can easily integration between other systems like Twitter, Facebook, Mail, … . You can find some more information on

Continue reading  

“OnAfterObjectsChanged” Event

I think the following scenario will sounds familiar to every developer.

You develop a nice new feature with a couple of tables, pages and codeunits. These new objects needs to be imported in the production environment.

You make a fob file of all your objects or create deltas, import it in the development environment and compiles the objects. And maybe you need to restore the NST, but this is questioned many times. Some are saying this is mandatory but I doubt it.

Before your solution will work, you need to do some setup in every company by opening the pages and provide the right parameters. A very time consuming (aka monkey task) to do and if your head isn’t clear you can forget something or make mistakes.

Would it be nice if the system itself will know when there are objects imported and auto configure your solution? That the system will raise an “OnAfterObjectsChanged” event the first time you open a client after you imported you objects.

That is what I’ve created and I will share it with you in a moment.

The first part is to determine if there are objects imported to the system. As you properly know these are created and updated in the system table “Object”.
Now I need to know when this table is changed from within NAV itself.

First, I thought to use “OnAfterInsert, OnAfterModify or OnAfterDelete Events” on this table, but these will not be raised from within the development environment when you import objects.

But then I come up with the following idea.

As you might know there is a field called “Timestamp” in every NAV table. This is maintained by SQL on every insert and update.
So, if I make a sum of all the timestamps in the “Object” table and compare it with a previous saved value, I know that something has changed and even that there are records deleted!

To get the sum of the timestamps, I used the following SQL statement and executed from within NAV itself.

Continue reading  

Avoid Factbox records on Empty pages

Factboxes are more then ever a powerfull way for presenting related information. Normally you link your Factbox through properties, but now and then you need to do this from code.

This works fine if your page has at least one record, because the filtering is set on the “OnAfterCurrRecord” trigger of the page. So when there is no records, no filter is set on you factbox and then all related records are shown. Continue reading  

How Do I: Easily Connect to External Databases from CAL in Microsoft Dynamics NAV 2016

It seems that I have missed the publication of my “How Do I” video in April.
Normally when Plataan and Microsoft publishes a video on youtube it appears on the Dynamics NAV blog (https://community.dynamics.com/nav/b/navvideos). But for some reason this one not. But no worries it was already on youtube.

In this video I have covered the new way of connecting to External Database from CAL. Continue reading  

Get Source Table from Page

Codeunit 700 Page Management is a Codeunit that I use once in a while. It has functions to get the Default Lookup Page or the Card Page of a certain table.
It also contains functions to open a Page by only passing a Table ID or a Record. You can run it default or modal and even open a page with an autofocus on a certain table field if you like.

All these functions are very handy, but I only miss one.

In my solution I need to get the table of a certain Page ID. So the opposite way of the existing functions.
By looking to the existing functions you will see that there’s a way. Most of the functions are using a system table called “Table Metadata”, were you can easy find the “Lookup Page”.

But the function “GetDefaultCardPageID” also uses the table “Page Metadata”.
So lets take a closer look to this table.

Continue reading