Tuesday, September 22, 2015

"TypeId" in Microsoft Dynamics AX 2012

In Microsoft Dynamics AX 2012 and onwards, 
"TypeId" function has been replaced by ExtendedTypeStr or EnumStr.

ExtendedTypeStr(EDT  _EDT) : for Extendet Data Type (EDT) with non Enum Type.
EnumStr(Enum  _Enum): for Base Enum and for Extendet Data Type (EDT) with Enum Type.

Friday, March 6, 2015

Error unable to compile "xxx,xx+xx,xx"

Today I got weird error to solve, which shows error message Unable to compile "100,00+12,00".

While opening TAX form from Purchase line this error occurred as below.

Actually, the culprit was function evalbuf, which is part of AX framework.

This function evaluates formula string. The limitation of this function is that we must use "." as decimal separator in formula string.

In our case the decimal separator was "," so evalbuf was throwing error "unable to compile" with expression passed as shown in above image.

To solve error, I have used strReplace function from global class which replaces "," to "." in the formula string.

Wednesday, March 4, 2015

Error "An unexpected error has occurred while opening the workflow. See the event log on the AOS and contact your system administrator to resolve the issue" on creating the workflow.

To resolve mentioned error we have following options.

Solution 1:
Do incremental CIL compile.

Not succeeded?!

Solution 2:
Do full CIL compile.

Still not succeeded?!

Solution 3:

Stop AOS service.

Rename XppIL folder to XppIL_old. form the following location.
<Drive letter>:\Program Files\Microsoft Dynamics AX\60\Server\<Instance Name>\bin

Start AOS service.

Do full CIL compilation.

Now your face should be filled with SMILE :)

Have any question?! Please comment.

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()
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.

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.