Data change notifications - what are my options?

Hello,

I’m developing a custom software, working with data coming from Axapta 3.0 SP3. I would like to be able to receive program notifications when records of needed types are changed within Axapta. What are my options here? I wouldn’t like to employ third-party solutions.

Thank you.

I am not sure of the format, but changes could be recorded in the database log or alerts can be configured, both of these would be considered user based ntoficiations of data changes.

Thank you for the answer. Log monitoring is feasible but requires some kind of translation from database objects to business objects. I guess, implementing some mechanism from within axapta would give better results in terms of types compliance and configuration changes survival. As far as I know, no alert service is available in axapta 3.0 sp3, am I wrong?

I have only worked with 4 onwards, so yes that statement could be true but I cannot confirm it.

Hello,

To confirm - alert service is not available in Dynamics Ax 3.0 version.

To elaborate on log monitoring -

  • Let us assume a table has been set up for insert action under database log (Administration → Setup → Database log)
  • When the above has been setup correctly, whenever a record is inserted into this table a call will be made to “logInsert” method in Application class.
  • Similarly for ‘delete’ action it will be ‘logDelete’ and for ‘updates’ it will be ‘logUpdate’ methods in the Application class.
  • Therefore through ‘application’ class, Ax 3.0 provides a hook for database related activities.

Perhaps you might want to place your code under appropriate methods in ‘Application’ class. Please note - depending on the volume, there will obviously be an overhead.

Hope this helps,

Thank you for your answer, it is very informative. The solution which I came upon is to override update delete and insert methods on each table I interested in and put changes information to a separate dedicated table, which then is read by polling from Axapta Business Connector. There are only about ten such tables, so it seems log monitoring in this case would indeed be too much.

Do you see there is something to be improved in my approach, given small number of monitored objects? Also is there a way to notify ABC client from inside Axapta?

Hello,

In order to provide educated reply, I would require the actual table list.

But generally speaking depending on type and nature of tables, there are some risks in overriding ‘insert’ methods at table level.

  • Let us assume one of the tables is of transactional type and used in scenarios like high volume import. Then chances could be that records might get inserted into this table by ‘array insert’. It is done this way because array inserts speeds up insert operations exceptionally quicker. But if the table’s insert method is overrided, then it will fall back to standard record by record insert.
  • Other scenario could be - if insert takes place through ‘doInsert’ method, this will by pass ‘insert’ method on the table. This will be applicable for ‘doUpdate’ and ‘doDelete’ methods as well i.e. ‘update’ and ‘delete’ methods will be by passed.

Regarding suggestions for improvement - if possible I would try to move this process into SQL Database. For example -

  • Tables in Ax contains properties like created date / time, modified date / time etc. This property could be switched on for your list of tables
  • Subsequently in SQL, a stored procedure could be written to pick up data from these tables on regular interval. With some little thinking, this could clevery written in such a way that it picks up only those records that were changed since last time SP was run

Obviously this might not provide real time benefit but could provide something close to that.

Hope this helps,

Thats a very valuable input, thank you very much. Entities I interested in are Customers, Customer Representatives, Goods, Prices, Stock and Orders. The software is supposed to list mentioned entities and place orders to axapta, which is rather popular type of project. There is an underlying database which should be maintaned in sync with axapta data.

Our initial intent was actually implementing the logic on database level. Though, we have no previous experience in axapta and considered this approach a risk. Some systems perform massive database metadata change in response to configuration adjustments, so we decided to stay at (possibly) safer side and implement on business level.

Does axapta perform bulk inserts on general basis? If this is a special case, we could live with that. Is it true that to be able to capture update events for sure on business level, we would have to override both Update/DoUpdate methods, or is there something more to it?

The database approach is very attractive, although how is it in regard to axapta best practices? For realtime we could add triggers to interested tables and call an external dll from stored procedure to notify our software.

Answer is yes. Array inserts for instance are used in many parts of system to update various areas. Examples are master planning, inventory adjustment etc.

Answer is no. You cannot override methods like doUpdate, doInsert etc.

Seeing that you are essentially after pure data and that you are not going to run any business logic inside Ax, best practice guidelines should not be an issue here.

Hope this helps,

Looks like the only consistent way to listen for changes is through database. We’re probably still better off using business layer to place orders to axapta. Thank you very much for your help.