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.

  • Hi KarrySodhi,

    Welcome to DUG!

    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.

Reply Children
No Data