Friday, August 12, 2016

Development Tutorial: FormObservable or how to handle display methods in the new Dynamics AX

In the new Dynamics AX the approach to how display/edit methods are refreshed by the kernel has changed to much less aggressive, meaning that after migrating your application to the latest version you might find that after opening the form the data is correct, but after performing actions and editing data the display/edit methods data is not refreshed.

This blog post is going to explain, how to handle such cases now.

I want to stress the importance of reading about this, since this is completely new (among many other things) in AX '7', and without full understanding of these mechanics you will not be able to write efficient and correctly working user interface code.

To summarize, here's a quick set of rules:
  • If your display method depends on form state or some data event, you might need to use one of the following two approaches:
    • The FormObservable attribute to flag an existing form or class variable
    • A new variable of the type FormObservableLink
  • If your display method depends on another data source, you might need to use the following approach:
    • The datasource.observe() method
As you can see from the names of these types, they are relying on the Observer pattern, subscribing to notifications about data changes, so as to invoke the refresh of the display/edit method data.


When I decided to finally write this blog post, I found out there's already somebody who beat me to it, so instead of repeating the same, here's a link, where you can read in more detail about each of the 3 above options:

FormObservable in Dynamics AX7

Enjoy, and kudos to the author of that blog.

No comments:

Post a Comment

Please don't forget to leave your contact details if you expect a reply from me. Thank you