The Infolog

A blog of Dynamics AX development tips and tricks

Skip to: Content | Sidebar | Footer

Display/Edit method caching

4 March, 2014 (10:54) | Dynamics AX | By: Howard Webb

When developing a new form or a new table that will have display or edit methods we should be thinking about how costly these types of methods are. Adding lots of these methods to a form can cause a large delay in opening and refreshing as these methods are recalculated every time a refresh is triggered on the form, which can occur when the user edits fields, uses menu items, or presses F5. We have a few options to allow caching of these methods, which can ease the number of round trips to the database.

If the method is declared on the table we can use the cacheAddMethod on the datasource to force the values to be cached. Using this method allows the form build engine to do all of the calculations for the methods in one round trip to the server saving time.

To do this we should call the method on the init of the datasource where the method lives. An example of this can be found on the SalesTable form. The SalesTable table has an edit method called editContactPersonName. This is used in the SalesTable form, however as the form has a lot going on the method is cached. The call to this method can be found in the init of the datasource:


We can also add caching to the control itself within it’s properties. There is a property called CacheDataMethod just under the datamethod which allows you to set the caching:


The settings for “Yes” and “No” are self-explanatory, Auto will cache the data method only when the form datasource is read-only.

Print Friendly, PDF & Email


Pingback from Caching display method – Dynamics AX = Denis Macchinetti – Microsoft Dynamics AX – Microsoft Dynamics Community
Time 7th March 2014 at 21:04

[…] that support also Edit Method.More info on :Optimizing display methods in AX 2012Display/Edit method cachingThat's […]

Comment from Howard Webb
Time 18th March 2014 at 22:17

Thanks, did not know about the SysClientCacheDataMethodAttribute method

Comment from Johnc758
Time 1st August 2014 at 09:57

I like the helpful information you provide in your articles. Ill bookmark your weblog and check again here regularly. I’m quite certain I will learn plenty of new stuff right here! Good luck for the next! deeeefkkekgc