Get alert in C# when an item is updated in Navision 2018

I am pushing data to navision using Item webservice.

However, I need to read the item from the Navision whenever it is updated by someone. One solution I have found is poll the service with “Last Modified Data” filter for items and check if that item is in the list or not.

I was thinking if there any any other way where I do not have to poll the server?

Thanks in advance.

Please read “Last Modified Data” as “Last Modified Date”

table trigger within nav table to write back to your C# application’s database/table would work?

I do not want to read from the database. As user can have different database than Sql. Also the Nav database is very complex I would need to find the table for different properties of the Items

I am not very clear what you want to achieve. more explanation would do good.

It it was me then I would use a webservice - and with that it does not matter what version of NAV the customer is running and that makes it easily upgradeable when perhaps later switching to Dyn365BC

The NAV webservice page takes about 10 minutes to do.

I thought karrysodhi was already using webservice and didnt want to use it, i was not clear. Your solution makes sense.

Hi KarrySodhi,

Welcome to DUG! [emoticon:c4563cd7d5574777a71c318021cbbcc8]

As I read you question, then you are already using a NAV item web service to update your external system. But instead of pulling the data with the web service, then you want NAV to notify you of any changes?

If your “application” is able to not only consume a web service, but also publish a web service, then one way could be to let NAV “ping” you application, whenever there an item is modified or created. All you need is a codeunit, which subscribes to the OnAfterModify, OnAfterInsert, OnAfterRename and OnAfterDelete events, which then will use a web service to “ping” your application.

While this solution is very easy (if you know NAV development) to do, then it is not perfect from a user perspective. When a user modifies an item, then they would have to wait, until the web service “ping” has completed, and if the web service call fails? So to minimize the waiting time and risk of no connection, then it would be better to save an “action” in a log and have another job pick up any new entries to this “log”. If you then setup and use NAV’s change log functionality, then you could also avoid create a new “log” table, and the subscriber codeunit.

But then we are basically back to where we started. If we have a job running in the job queue, to check for any item changes, then why not keep whatever you have right now, and just have your application ask for any changed items using the “Last Modified Date” (except I would prefer to use a DateTime field)?

The end result is the same, if you push or pull, when both applications are under your control, and you don’t need to change anything else.

Its not like I do not want to use the web service. It is always good to have asks the experts :)/ [mention:74275055534c437ab13054c27a1ed5fb:e9ed411860ed4f2ba0265705b8793d05] I will be using webservice to check the last modified items. Thanks for the suggestion guys.

Thanks for the detailed answer Erik. I did not even know that I can have NAV ping my service. Though I think I am going to Ping the NAV to get the last modified items.