Wednesday 29 October 2008

SysTableLookup and Int64 Fields

In AX 4 (I haven't checked '09 yet), 64 bit integer fields aren't supported by the SysTableLookup class that is often used to programmatically generate lookup forms at runtime. This means RecId fields pose a potential problem.

Automatically generated lookup forms still function correctly, but in the case of lookups that can't be adequately filtered using relations we run into problems.

An easy solution is to add an extra case to the switch statement found in SysTableLookup.performFormLookup as shown below.

case classnum(FormInt64Control):
callingIntControl = callingControl;
callingIntControl.performFormLookup(this.formRun());
break;

Whilst this solves the problem, programmatically generating lookup forms is against best practice, so a better solution to this problem is to create a form to be used as the lookup form.

Tuesday 13 May 2008

Identifying Production, UAT and DEV Environments on the Status Bar

In AX 4, the lack of ability to easily identify whether the AX window you have open is the production, UAT or development system is something that I find really painful at times. Perhaps its my bad habit of having multiple instances of each open at any given time that causes the problem, but I often find myself closing every open instance and reopening because I've forgotten which is which.


My current solution interferes slightly with version control, so if you're using a version control system with AX you'll have to test this for yourself (the init method of the VersionControl class writes to the custom item area on the status bar as well).


This simple mod works by modifying the startupPost method of the Application class so that at startup, the database server name as well as the database name are written to the status bar using the Infolog.WriteCustomStatlineItem method.


The modified Application class code below first enables the custom stat line text functionality for the current user and then writes the relevent SysSQLSystemInfo to the status bar.


void startupPost()
{
SysSQLSystemInfo systemInfo = SysSQLSystemInfo::construct();
;

xUserInfo::statusLine_CustomText(true);
infolog.writeCustomStatlineItem (systemInfo.getLoginServer() + ' :: ' + systemInfo.getloginDatabase());
}


The problem is this still doesn't work as VersionControl.Init, which is called during startup, after Application.StartupPost, sets the custom stat line item to an empty string method.


The solution to this is to simply comment out infolog.writeCustomStatlineItem(''); in the VersionControl class.

This is the final result (where the DB server is AXAPTA1 and the DB name for the UAT is Dynamics-UAT):




As you can see above, with our DB naming structure, this provides a very obvious and simple way of identifying which environment the current window relates to.

Wednesday 23 April 2008

AX so far...

Welcome to DAX notes!

I've set this blog up to chronicle my experiences implementing AX for a company in the food manufacturing industry. The last 9 months I've spent learning and implementing DAX have been fascinating, so from here I hope you enjoy this blog as it details our tales of implementation, development and integration.

Doug