Tuesday, January 20, 2015

Caching Display Methods in Microsoft Dynamics AX

The performance of display methods can be improved by caching mechanism.

This must be used while methods are of following nature.
1) Used for complex calculations.
2) Returning large string data.
3) Display image data.

How To:

Option 1:
  • On the form expand the Data Sources node.
  • Override init method.
  • Call formDataSource.cacheAddMethod() after super() in the init method.
  • First parameter determines name of method 
  • Second parameter is boolean, which indicates that whether the value of display method is updated when record is written to the database.
Public void init()
{
super();
this.cacheAddMethod(
tablemethodstr(<table>,<display method>),                                       [_updateOnWrite]
); 

}

Option 2:
  • Use "SysClientCacheDataMethodAttribute" attribute in display method declaration.
[SysClientCacheDataMethodAttribute ([_updateOnWrite])]
display <ReturnType> methodName(){....}




Option 3:
  • Set form control property CacheDataMethod to “Yes” on the form. This option is available for methods which are created at table level.

Note:
The value of all cached methods is set when data is fetched from the back-end database. In addition, the value is refreshed when the reread method is called on the form data source.

All the above options are supported with AX 2012 R2 & R3, for AX 2009 only first option is available.


Happening

Upgrade from AX 2012 to Latest Dynamics 365 Finance and Operation

Below are the steps defined by sequence. 1. Create new Upgrade project in Dynamics LCS. 2. Create VSTS Project and connect it with L...

Trending now