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.